-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (37 loc) · 2.27 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (37 loc) · 2.27 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
41
42
43
44
45
46
47
48
49
# syntax=docker/dockerfile:1
FROM python:3.14-slim AS base
# ── System deps ──────────────────────────────────────────────────────────────
# upgrade picks up security patches for packages already in the base image
# (e.g. liblzma5) that may lag behind the base image's own release date.
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# ── Non-root user ─────────────────────────────────────────────────────────────
RUN groupadd --gid 1000 appuser \
&& useradd --uid 1000 --gid 1000 --no-create-home appuser
WORKDIR /app
# ── Python deps (cached layer) ────────────────────────────────────────────────
COPY requirements.txt .
RUN python -m venv /app/.venv \
&& /app/.venv/bin/pip install --no-cache-dir --upgrade pip>=26.0 \
&& /app/.venv/bin/pip install --no-cache-dir -r requirements.txt
ENV PATH="/app/.venv/bin:$PATH"
# ── App source ────────────────────────────────────────────────────────────────
COPY media-servarr-sync.py .
COPY templates/ templates/
COPY static/ static/
# Create data directory for persistent storage
RUN mkdir -p /data && chown appuser:appuser /data
# Drop privileges
USER appuser
# ── Runtime ───────────────────────────────────────────────────────────────────
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
ARG PORT=5000
ENV PORT=${PORT}
EXPOSE ${PORT}
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
CMD /bin/sh -c 'curl -sf http://localhost:${PORT:-5000}/health || exit 1'
ENTRYPOINT ["python", "media-servarr-sync.py"]