Files
Vault/Dockerfile.transcoder
T
twotalesanimation 08b6e58b8e
Deploy Vault CMS / deploy (push) Successful in 2m23s
Patch React2Shell RCE and harden auth, uploads and containers
- Upgrade next 16.0.3 -> 16.3.5 and react/react-dom 19.2.0 -> 19.3.0
  (CVE-2025-55182 / CVE-2025-66478 unauthenticated RCE), next-auth -> 4.24.15
- Require admin role on /api/users, /api/courses and /api/enrollments,
  which were unauthenticated
- Replace ALLOWED_ADMINS checks that allowed any signed-in user when the
  variable was empty with the role-based requireAdmin
- Sanitize upload filenames, restrict thumbnail extensions, store edited
  thumbnails in UPLOADS_DIR, tighten traversal checks in file routes
- Dockerfile: Node 22, pinned pnpm, non-root user, critical audit gate
- Compose: read-only rootfs, dropped caps, no-new-privileges, Postgres
  password from env
- Exclude .env from Docker build context; add security headers
- Deploy with git reset --hard instead of git pull
- Remove stale package-lock.json

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 11:52:33 +02:00

56 lines
1.2 KiB
Docker

# ==============================
# Build stage
# ==============================
FROM node:22-alpine AS builder
WORKDIR /app
# Copy package files and Prisma schema FIRST
COPY transcoder/package.json transcoder/tsconfig.json ./
COPY prisma ./prisma
# Set a temporary DATABASE_URL for Prisma schema generation during build
ENV DATABASE_URL="postgresql://user:password@localhost:5432/dummy"
# Install all deps (including dev)
RUN npm install
# Copy source
COPY transcoder ./
# Build TypeScript
RUN npm run build
# ==============================
# Runtime stage
# ==============================
FROM node:22-alpine
# Install FFmpeg
RUN apk add --no-cache ffmpeg
WORKDIR /app
# Copy package files
COPY transcoder/package.json ./
# Copy node_modules from builder (includes all dependencies)
COPY --from=builder /app/node_modules ./node_modules
# Copy compiled output
COPY --from=builder /app/dist ./dist
# Copy Prisma schema
COPY prisma ./prisma
# Environment defaults (can be overridden)
ENV NODE_ENV=production
ENV UPLOADS_DIR=/uploads
# Run as the unprivileged "node" user (uid 1000) instead of root
USER node
# The container runs once and exits
CMD ["node", "dist/index.js"]