-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (24 loc) · 850 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
# Base
FROM python:3.12-slim-bookworm as base
ENV PYTHONBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Builder
FROM base as builder
ENV POETRY_VERSION=1.8.3 \
POETRY_VIRTUALENVS_IN_PROJECT=false \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_NO_INTERACTION=1
COPY ./application/poetry.lock ./application/pyproject.toml ./
RUN pip install poetry==$POETRY_VERSION \
&& poetry install --no-root
# Runner
FROM base as runner
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY ./application /app
CMD [ "/bin/bash", "-c", "python manage.py migrate && gunicorn config.wsgi:application -b 0.0.0.0:8000"]