-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (36 loc) · 984 Bytes
/
Dockerfile
File metadata and controls
47 lines (36 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
41
42
43
44
45
46
47
FROM python:3.13-alpine3.20 AS builder
ENV PYTHONUNBUFFERED=1
# Copy app
WORKDIR /app
COPY . /app
# Create venv
RUN python -m venv /opt/venv
# Enable venv
ENV PATH="/opt/venv/bin:$PATH"
# Install dependencies
## Build dependencies
RUN apk add postgresql-dev gcc musl-dev libffi-dev rust cargo
RUN pip install gunicorn psycopg[c]
## App dependencies
RUN apk add git xmlsec gettext
RUN pip install -r requirements.txt
FROM python:3.13-alpine3.20
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install App dependencies
RUN apk add --no-cache xmlsec gettext
# Copy over the build venv
COPY --from=builder /opt/venv /opt/venv
# Enable the venv globally
ENV PATH="/opt/venv/bin:$PATH"
# Copy over the app again
COPY --from=builder /app .
# Compile messages
RUN python manage.py compilemessages
# Collect static files
## Create public dir to store them in
RUN mkdir -p /app/public/static
## Collect them
RUN python manage.py collectstatic --noinput
EXPOSE 7000
CMD ["sh", "docker/run.sh"]