-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
32 lines (23 loc) · 995 Bytes
/
Copy pathdockerfile
File metadata and controls
32 lines (23 loc) · 995 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
FROM python:3.12-slim
WORKDIR /app
# Dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# App files
COPY . .
# Non-root gebruiker; uid 1000 matcht de PUID uit het compose-voorbeeld.
# Zorg dat /config bestaat en schrijfbaar is voor de app.
RUN useradd --create-home --uid 1000 mpwatcher \
&& mkdir -p /config \
&& chown -R mpwatcher:mpwatcher /config /app
USER mpwatcher
# Versienummer: door CI meegegeven (release-tag of commit-sha)
ARG APP_VERSION=dev
ENV PYTHONUNBUFFERED=1 \
MPWATCHER_CONFIG_DIR=/config \
MPWATCHER_VERSION=$APP_VERSION
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=4)" || exit 1
# Eén worker: de scheduler draait in-process en mag maar één keer bestaan.
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "1", "--threads", "8", "--timeout", "120", "app:app"]