Files
music-mirror/Dockerfile
T

34 lines
1.2 KiB
Docker
Raw Permalink Normal View History

# Alpine rather than Debian slim purely because of ffmpeg's dependencies.
# Debian's ffmpeg depends on libavdevice, which can render to X11, Wayland and
# OpenGL, so it drags in Mesa and with it LLVM (127 MB) and Z3 (27 MB) to
# encode an MP3 on a headless NAS. Alpine's build brings none of that: 576 MB
# down to 189 MB.
FROM python:3.13-alpine AS runtime
ENV PYTHONUNBUFFERED=1
# ffmpeg does the encoding; the application itself has no Python dependencies.
RUN apk add --no-cache ffmpeg
WORKDIR /app
COPY pyproject.toml README.md ./
COPY music_mirror.py ./
RUN pip install --no-cache-dir . \
&& rm -rf build music_mirror.egg-info
# Runs as root by default so a bind-mounted dataset of any ownership is
# writable. Override with `user:` in compose to run as the dataset's owner.
ENTRYPOINT ["music-mirror"]
# Test stage: the suite runs against this image's own ffmpeg, which is the one
# that ships. Build it with `--target test`; a failing test fails the build.
# The published image is the `runtime` stage above and carries none of this.
FROM runtime AS test
RUN pip install --no-cache-dir pytest
COPY pytest.ini ./
# Host-side tools; not in the runtime image, but the suite covers them.
COPY tools ./tools
COPY tests ./tests
RUN python -m pytest