FROM node:22-alpine

RUN apk add --no-cache ffmpeg

WORKDIR /app

COPY package.json package-lock.json* ./

# Use npm install instead of npm ci to avoid esbuild ETXTBSY errors
RUN npm install --ignore-scripts

COPY . .

RUN npm run build

CMD ["node", "dist/index.js"]
