# One image for both services: `web` (Next.js: the pages and the API) and
# `worker` (node server/worker.js: the stream, requests, launches, stats, fees).
FROM node:22-alpine AS build
WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED=1
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build && npm prune --omit=dev

FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1
COPY --from=build /app ./
EXPOSE 3005
CMD ["node_modules/.bin/next", "start", "-H", "0.0.0.0", "-p", "3005"]
