-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
45 lines (28 loc) · 819 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# syntax=docker/dockerfile:1
FROM python:3.8-slim-buster as requirements-stage
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VERSION=1.1.13
# 1st stage
WORKDIR /tmp
#
RUN pip install "poetry==$POETRY_VERSION"
#
COPY ./pyproject.toml ./poetry.lock* /tmp/
#
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
# 2nd stage
FROM python:3.8-slim-buster
#
WORKDIR /testauthapi-docker
#
COPY --from=requirements-stage /tmp/requirements.txt ./requirements.txt
#
RUN pip install --no-cache-dir --upgrade -r ./requirements.txt
COPY . .
EXPOSE $PORT
CMD exec gunicorn --bind :$PORT --workers 2 --worker-class uvicorn.workers.UvicornWorker main:app