2026-06-15 02:22:27 +02:00
|
|
|
# Build/version info. APP_VERSION comes from the committed VERSION file (always correct,
|
|
|
|
|
# even for a plain `docker compose build`); GIT_SHA/BUILD_DATE are best-effort build-args
|
|
|
|
|
# the deploy scripts pass. An explicit APP_VERSION build-arg still overrides the file.
|
|
|
|
|
ARG APP_VERSION=
|
2026-06-15 00:06:57 +02:00
|
|
|
ARG GIT_SHA=unknown
|
|
|
|
|
ARG BUILD_DATE=
|
|
|
|
|
|
2026-06-11 02:19:47 +02:00
|
|
|
# Stage 1: build the frontend SPA
|
|
|
|
|
FROM node:20-alpine AS frontend
|
2026-06-15 00:06:57 +02:00
|
|
|
ARG APP_VERSION
|
|
|
|
|
ARG GIT_SHA
|
|
|
|
|
ARG BUILD_DATE
|
2026-06-11 02:19:47 +02:00
|
|
|
WORKDIR /fe
|
|
|
|
|
COPY frontend/package.json ./
|
|
|
|
|
RUN npm install
|
|
|
|
|
COPY frontend/ ./
|
2026-06-15 02:22:27 +02:00
|
|
|
COPY VERSION ./.version
|
|
|
|
|
# Vite inlines VITE_*-prefixed env at build time; version falls back to the VERSION file.
|
|
|
|
|
RUN VITE_APP_VERSION="${APP_VERSION:-$(cat ./.version)}" \
|
|
|
|
|
VITE_GIT_SHA="$GIT_SHA" \
|
|
|
|
|
VITE_BUILD_DATE="$BUILD_DATE" \
|
|
|
|
|
npm run build
|
2026-06-11 02:19:47 +02:00
|
|
|
|
|
|
|
|
# Stage 2: backend runtime, serving the built SPA
|
|
|
|
|
FROM python:3.12-slim
|
2026-06-15 00:06:57 +02:00
|
|
|
ARG GIT_SHA
|
|
|
|
|
ARG BUILD_DATE
|
2026-06-11 02:19:47 +02:00
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
|
PIP_NO_CACHE_DIR=1 \
|
2026-06-15 00:06:57 +02:00
|
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
|
|
|
GIT_SHA=$GIT_SHA \
|
|
|
|
|
BUILD_DATE=$BUILD_DATE
|
2026-06-11 02:19:47 +02:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
feat(downloads): M1 — schema, config, worker container, deps
- models: MediaAsset (shared file cache, unique on source+format_sig), DownloadJob
(per-user request), DownloadProfile (presets), DownloadShare (ACL), DownloadQuota
- migrations 0036 (5 tables) + 0037 (6 builtin presets)
- sysconfig 'downloads' group (per-user defaults, retention/GC, layout, worker concurrency)
- config: DOWNLOAD_ROOT / WORKER_ENABLED env + download defaults
- deps: yt-dlp in requirements, ffmpeg in Dockerfile runtime stage
- worker: dedicated container (python -m app.worker), thin idle entry (loop lands in M2)
- localdev compose: worker service + downloads bind-mount; gitignore downloads/
2026-07-02 23:57:40 +02:00
|
|
|
# ffmpeg is required by the download center (yt-dlp) to merge separate video+audio streams
|
|
|
|
|
# and run postprocessing (audio extract, embed thumbnail/chapters/subs, SponsorBlock).
|
|
|
|
|
RUN apt-get update \
|
|
|
|
|
&& apt-get install -y --no-install-recommends ffmpeg \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2026-06-11 02:19:47 +02:00
|
|
|
COPY backend/requirements.txt .
|
2026-06-14 05:59:34 +02:00
|
|
|
RUN pip install --upgrade pip && pip install -r requirements.txt
|
2026-06-11 02:19:47 +02:00
|
|
|
|
|
|
|
|
COPY backend/ .
|
2026-06-15 02:22:27 +02:00
|
|
|
# Read at runtime by config.py as the app_version (a committed single source of truth).
|
|
|
|
|
COPY VERSION ./VERSION
|
2026-06-11 02:19:47 +02:00
|
|
|
COPY --from=frontend /fe/dist ./app/static_spa
|
|
|
|
|
|
|
|
|
|
RUN adduser --disabled-password --gecos "" appuser && chown -R appuser /app
|
|
|
|
|
USER appuser
|
|
|
|
|
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
CMD ["sh", "entrypoint.sh"]
|