# Stage 1: UV + Python base with beets FROM python:3.11-slim AS python-base RUN apt-get update && apt-get install -y curl ffmpeg imagemagick git && rm -rf /var/lib/apt/lists/* RUN pip install uv WORKDIR /app COPY requirements.txt ./ RUN uv pip install -r requirements.txt # Stage 2: Node build FROM node:24-alpine AS node-builder WORKDIR /app COPY package*.json pnpm-lock.yaml* ./ COPY .npmrc ./ RUN corepack enable pnpm && pnpm install --frozen-lockfile COPY . . RUN corepack enable pnpm && pnpm build # Stage 3: Unified runtime FROM python:3.11-slim RUN apt-get update && apt-get install -y curl ffmpeg imagemagick git && rm -rf /var/lib/apt/lists/* RUN pip install uv WORKDIR /app COPY requirements.txt ./ RUN uv pip install -r requirements.txt COPY --from=node-builder /app/package*.json ./ COPY --from=node-builder /app/node_modules ./node_modules COPY --from=node-builder /app/build ./build RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 appuser USER appuser EXPOSE 3000 CMD ["node", "build"]