Build and Publish Backend Image / build (push) Failing after 14s
YouTube playback relied on manual changes inside the running container (deno install + /etc/yt-dlp.conf) that would be lost on any recreate. Make it permanent and reproducible: - Dockerfile.backend: install pinned deno 2.8.3 as yt-dlp's JS runtime and write a system-wide /etc/yt-dlp.conf enabling the EJS challenge solver (--js-runtimes deno, --remote-components ejs:github, --force-ipv4). Replaces the unreliable node-based config. - .gitea/workflows/build-backend.yml: build Dockerfile.backend and push git.qomar.pw/omar/ts6-manager/backend:latest (amd64). Needs REGISTRY_TOKEN. - docker-compose.yml: pull backend from the Gitea registry; frontend/sidecar stay on upstream clusterzx images. Mount ./secrets read-only for optional YouTube cookies via YT_COOKIE_FILE. - gitignore/dockerignore: never commit cookies (live Google session). - DEPLOY.md: deployment + CI notes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
61 lines
2.4 KiB
Docker
61 lines
2.4 KiB
Docker
# syntax=docker/dockerfile:1.4
|
|
FROM node:20-slim AS base
|
|
RUN corepack enable && corepack prepare pnpm@9 --activate
|
|
|
|
# Deno: JS runtime yt-dlp uses to solve YouTube's nsig / player-JS challenge via the
|
|
# EJS remote component. `node` alone is unreliable for this; deno is the proven runtime.
|
|
# Pinned to the version verified working in production. See /etc/yt-dlp.conf below.
|
|
COPY --from=denoland/deno:bin-2.8.3 /deno /usr/local/bin/deno
|
|
|
|
# Install system deps: openssl (Prisma), ffmpeg (audio), python3+pip (yt-dlp)
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
openssl \
|
|
ffmpeg \
|
|
python3 \
|
|
python3-pip \
|
|
ca-certificates \
|
|
&& python3 -m pip install --break-system-packages --no-cache-dir -U "yt-dlp[default]" \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy everything at once to avoid BuildKit ordering bug on Windows
|
|
FROM base AS build
|
|
COPY . .
|
|
RUN pnpm install --no-frozen-lockfile
|
|
RUN pnpm --filter @ts6/common run build
|
|
RUN pnpm --filter @ts6/backend exec prisma generate
|
|
RUN pnpm --filter @ts6/backend run build
|
|
|
|
# Production image
|
|
FROM base AS production
|
|
ENV NODE_ENV=production
|
|
WORKDIR /app
|
|
|
|
COPY --from=build /app/node_modules ./node_modules
|
|
COPY --from=build /app/package.json ./package.json
|
|
COPY --from=build /app/pnpm-workspace.yaml ./pnpm-workspace.yaml
|
|
COPY --from=build /app/packages/common/dist ./packages/common/dist
|
|
COPY --from=build /app/packages/common/package.json ./packages/common/package.json
|
|
COPY --from=build /app/packages/backend/dist ./packages/backend/dist
|
|
COPY --from=build /app/packages/backend/generated ./packages/backend/generated
|
|
COPY --from=build /app/packages/backend/prisma ./packages/backend/prisma
|
|
COPY --from=build /app/packages/backend/package.json ./packages/backend/package.json
|
|
COPY --from=build /app/packages/backend/node_modules ./packages/backend/node_modules
|
|
|
|
WORKDIR /app/packages/backend
|
|
# System-wide yt-dlp config (works regardless of which user the process runs as).
|
|
# This is the fix that solves YouTube playback: deno runtime + EJS challenge solver.
|
|
RUN mkdir -p data /data/music && \
|
|
printf '%s\n' \
|
|
'--js-runtimes deno' \
|
|
'--remote-components ejs:github' \
|
|
'--force-ipv4' \
|
|
> /etc/yt-dlp.conf
|
|
|
|
EXPOSE 3001
|
|
ENV SIDECAR_URL=http://ts6-sidecar:9800
|
|
CMD ["sh", "-c", "npx prisma db push --skip-generate && npx prisma db seed || true && node dist/index.js"]
|