-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
35 lines (23 loc) · 965 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
FROM python:3.10-alpine
# install system dependencies
RUN apk --no-cache add bash postgresql-libs libffi-dev make \
&& apk --no-cache add --virtual .build-deps gcc g++ postgresql-dev musl-dev git
# use bash
SHELL ["/bin/bash", "-c"]
# upgrade pip and install poetry
RUN pip install --upgrade pip && pip install poetry
WORKDIR /app
# copy bare minimum needed to install python dependecies with poetry
COPY ./README.md ./pyproject.toml ./poetry.lock ./
# install locked python dependecies using poetry to generate a requirements.txt
RUN pip install -r <(poetry export)
# copy everything else
COPY ./ ./
# install our app
RUN pip install .
# free up some space
RUN apk --no-cache del .build-deps
# Docker friendly env vars for Python
ENV PYTHONUNBUFFERED=1 PYTHONFAULTHANDLER=1
CMD [ "gunicorn", "--bind=0.0.0.0:8080", "--worker-class=gevent", "--workers=4", "--access-logfile=-", "--error-logfile=-", "configdb.wsgi:application" ]
EXPOSE 8080/tcp