-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (29 loc) · 984 Bytes
/
Dockerfile
File metadata and controls
40 lines (29 loc) · 984 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
30
31
32
33
34
35
36
37
38
39
40
# install dependencies
FROM python:3.12-alpine AS builder
COPY poetry.lock pyproject.toml ./
RUN python -m pip install --no-cache-dir poetry==1.8.2 \
&& poetry export --without-hashes --without dev --with production -f requirements.txt -o requirements.txt
# Run actual container
FROM python:3.12-slim-bullseye
RUN apt update && \
apt install -y gcc libpq-dev && \
apt clean && \
rm -rf /var/cache/apt/*
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=utf-8
COPY --from=builder requirements.txt /tmp/
RUN pip install -U pip && \
pip install --no-cache-dir -r /tmp/requirements.txt
COPY src/ /src/
COPY scripts/ /src/scripts/
COPY gunicorn/ /src/gunicorn/
COPY logging_production.ini /src/
COPY alembic.ini /src/
COPY alembic/ /src/alembic
ENV PATH "$PATH:/src/scripts"
RUN useradd -m -d /src -s /bin/bash app \
&& chown -R app:app /src/* && chmod +x /src/scripts/*
WORKDIR /src
# Run app
CMD ["./scripts/start-prod.sh"]