Adds a pull-based production option so the host no longer builds/installs deps
on every restart:
- backend/Dockerfile + scrobble/Dockerfile bake the heavy deps (ffmpeg, Deno,
yt-dlp, node libs). Backend still refreshes yt-dlp on start (non-fatal).
- docker-compose.prod.yml pulls ${REGISTRY}/novasonic-*:${TAG}.
- scripts/build-push-images.mjs (npm run push-images) builds + pushes all three.
- .env.example documents every var incl. REGISTRY/TAG; .env gitignored.
The build-on-host docker-compose.yml stays as-is.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
33 lines
1.4 KiB
Docker
33 lines
1.4 KiB
Docker
# NovaSonic download backend — bakes the heavy deps (ffmpeg, Deno, yt-dlp, node libs) so restarts are
|
|
# instant instead of re-installing everything on every boot. Build context = ./backend.
|
|
FROM node:22-slim
|
|
|
|
# System deps: python (yt-dlp), ffmpeg (tagging/convert), curl/git/unzip (installers), ca-certs.
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
python3 python3-pip ffmpeg curl git unzip ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# yt-dlp (nightly) + the Spotify helper tooling.
|
|
RUN pip install --break-system-packages -U --pre 'yt-dlp[default]' \
|
|
&& pip install --break-system-packages spotapi 'git+https://github.com/TzurSoffer/spotify-downloader'
|
|
|
|
# Deno — yt-dlp uses it to solve YouTube's JS signature/nsig challenge.
|
|
RUN curl -fsSL https://deno.land/install.sh | sh
|
|
ENV PATH="/root/.deno/bin:${PATH}"
|
|
|
|
# Node libs the server loads (express, kuromoji) — kept out of the app dir like the compose setup did.
|
|
WORKDIR /deps
|
|
RUN npm install express kuromoji
|
|
ENV NODE_PATH=/deps/node_modules
|
|
|
|
# App code.
|
|
WORKDIR /app
|
|
COPY . /app/
|
|
|
|
ENV PORT=3700 DATA_PATH=/data
|
|
EXPOSE 3700
|
|
|
|
# Refresh yt-dlp on start (heavy deps already baked, so this is a quick pull) — non-fatal if offline,
|
|
# the baked version still works. Keeps the "always-latest yt-dlp" behaviour of the old compose command.
|
|
CMD ["sh","-c","pip install --break-system-packages -U --pre 'yt-dlp[default]' >/dev/null 2>&1 || true; node novasonic-server.js"]
|