-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (18 loc) · 701 Bytes
/
Dockerfile
File metadata and controls
29 lines (18 loc) · 701 Bytes
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
FROM python:3.8-buster as build
COPY . .
RUN pip install -U --no-cache-dir pip poetry setuptools wheel && \
poetry build -f wheel && \
poetry export -f requirements.txt -o requirements.txt --without-hashes && \
pip wheel -w dist -r requirements.txt
FROM python:3.8-slim-buster as runtime
WORKDIR /usr/src/app
ENV PYTHONOPTIMIZE true
ENV DEBIAN_FRONTEND noninteractive
# setup timezone
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY --from=build dist dist
COPY --from=build main.py gunicorn.config.py ./
RUN pip install -U --no-cache-dir pip dist/*.whl && \
rm -rf dist
CMD ["gunicorn", "main:app", "-c", "gunicorn.config.py"]