# Monorepo app builder for occupymedia.cc — APP build-arg: api | scheduler | web # (media-worker has its own image: ../../infra/media-worker.Dockerfile) FROM node:22-slim ARG APP ARG NEXT_PUBLIC_API_URL=https://api.occupymedia.cc ENV APP_MODE=${APP} NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} WORKDIR /app RUN corepack enable RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/* COPY . . # Full workspace tree present so every workspace:* dependency resolves. # Do NOT "optimize" to a filtered install — scheduler/web builds broke on # missing build tools (tsc) and missing workspace manifests (connector-sdk). RUN NODE_ENV=development npx --yes pnpm@9.12.0 install --frozen-lockfile # egress is native-imported by path at runtime (NOT a package.json dep), so the # --filter app build never builds it — skip this line and the api crashes at boot. RUN npx --yes pnpm@9.12.0 --filter @tactical-media-broadcast-hub/egress build RUN npx --yes pnpm@9.12.0 --filter @tactical-media-broadcast-hub/${APP}... build ENV NODE_ENV=production EXPOSE 3000 CMD ["sh", "-c", "case \"$APP_MODE\" in \ api) exec node /app/apps/api/dist/apps/api/src/main.js ;; \ scheduler) exec node /app/apps/scheduler/dist/worker.js ;; \ web) cd /app/apps/web && exec node ./node_modules/next/dist/bin/next start -H 0.0.0.0 -p \"${PORT:-3001}\" ;; \ *) echo \"unknown APP $APP_MODE\" && exit 1 ;; \ esac"]