-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.dev
35 lines (27 loc) · 981 Bytes
/
Dockerfile.dev
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
FROM python:3.10.1-slim-bullseye as builder
# Install poetry for building
WORKDIR /build
ENV POETRY_VERSION=1.3.1
COPY poetry.lock pyproject.toml ./
RUN pip install "poetry==$POETRY_VERSION" && python -m venv /venv && poetry export --with dev -f requirements.txt | /venv/bin/pip install -r /dev/stdin
FROM python:3.10.1-slim-bullseye as runner
# Set enviroment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV PUID=10000
ENV PGID=10001
ENV VIRTUAL_ENV=/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV ENV_FOR_DYNACONF=docker
# Copy environment, change owner, and install system dependencies
WORKDIR /app
# Install linux dependencies
COPY --from=builder /venv /venv
RUN apt update &&\
apt install libmagic1 libcurl3-gnutls tzdata gosu -y --no-install-recommends &&\
rm -rf /var/lib/apt/lists/* &&\
python3 -m venv $VIRTUAL_ENV
COPY .docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["python3", "./main.py"]