-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
43 lines (27 loc) · 865 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
ARG WORKDIR="/app"
FROM python:3.11-alpine as base
# Remember to also update in pyproject.toml
ENV POETRY_VERSION=1.7.1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
FROM base as deps
ARG WORKDIR
WORKDIR ${WORKDIR}
# We need a compiler and some stuff
RUN apk add build-base libffi-dev \
&& rm -rf /var/cache/apk/*
# Install poetry separated from system interpreter
RUN pip install -U pip setuptools \
&& pip install poetry==${POETRY_VERSION}
# Install dependencies
COPY poetry.lock pyproject.toml ./
RUN poetry config virtualenvs.in-project true
RUN poetry install --only main
FROM base
ARG WORKDIR
WORKDIR ${WORKDIR}
COPY --from=deps ${WORKDIR}/.venv ${WORKDIR}/.venv
ENV PATH="${WORKDIR}/.venv/bin:$PATH"
COPY . .
EXPOSE 80
CMD gunicorn unicorn.wsgi --bind 0.0.0.0:80 -w 6 --chdir unicorn/ --access-logfile '-' --error-logfile '-'