-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (33 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
40 lines (33 loc) · 1.28 KB
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
FROM python:3.11-slim
WORKDIR /app
# Installing system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates gnupg \
&& curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/postgresql-archive-keyring.gpg] http://apt.postgresql.org/pub/repos/apt trixie-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update && apt-get install -y --no-install-recommends \
libjpeg-dev \
zlib1g-dev \
libtiff-dev \
libwebp-dev \
libmagic1 \
libpq-dev \
postgresql-client-18 \
docker-cli \
poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# Installing Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copying the code
COPY . .
RUN pybabel compile -d translations && \
addgroup --system --gid 1000 appuser && \
adduser --system --uid 1000 --gid 1000 appuser && \
mkdir -p /app/data && \
chown -R appuser:appuser /app && \
chmod -R 755 /app/data
# Switching to an unprivileged user
USER appuser
# Launching with Gunicorn (configuration from gunicorn_config.py)
CMD ["gunicorn", "-c", "gunicorn_config.py", "wsgi:app"]