chore: production docker + compose for LAN deployment

This commit is contained in:
2026-02-12 11:22:47 +01:00
parent 3a0bb1cd37
commit e1c939799b
9 changed files with 218 additions and 4 deletions

45
Dockerfile Normal file
View File

@@ -0,0 +1,45 @@
# syntax=docker/dockerfile:1
FROM python:3.12-slim AS runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# System deps (kept minimal). We install curl for a simple container healthcheck.
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -r -u 10001 -g root syncplayer
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy app code
COPY . .
# Default persistent directories (can be mounted).
ENV DATA_DIR=/data \
MEDIA_DIR=/data/media \
LOG_DIR=/data/logs \
HOST=0.0.0.0 \
PORT=5000 \
ASYNC_MODE=eventlet
RUN mkdir -p /data/media /data/logs \
&& chown -R syncplayer:root /data
USER syncplayer
EXPOSE 5000
# Basic HTTP healthcheck (admin redirect)
HEALTHCHECK --interval=15s --timeout=3s --start-period=10s --retries=3 \
CMD curl -fsS http://127.0.0.1:${PORT}/ >/dev/null || exit 1
# Gunicorn + eventlet is a solid choice for Flask-SocketIO.
# We intentionally run a single worker to avoid starting multiple UDP listeners.
CMD ["gunicorn", "-k", "eventlet", "-w", "1", "-b", "0.0.0.0:5000", "wsgi:app"]