FROM node:24-alpine

WORKDIR /app

RUN apk add --no-cache ffmpeg chromium nss freetype harfbuzz ttf-freefont

COPY package*.json ./
RUN npm install --omit=dev --no-audit --no-fund

COPY src ./src
COPY scripts ./scripts

RUN mkdir -p /app/src/web/public/vendor/animate.css && cp /app/node_modules/animate.css/animate.min.css /app/src/web/public/vendor/animate.css/animate.min.css
RUN mkdir -p /app/src/player/public/vendor/animate.css && cp /app/node_modules/animate.css/animate.min.css /app/src/player/public/vendor/animate.css/animate.min.css

RUN mkdir -p /app/media

EXPOSE 3000

CMD ["npm", "run", "start:web"]
