# Dev image for the publisher SPA — built within the npm workspace (context = repo root).
# In docker-compose the workspace dirs are bind-mounted and deps are reinstalled on start,
# so this image just needs Node + a warm install for the first run.
FROM node:22-alpine
WORKDIR /app

# Workspace manifests first (layer cache). All are needed so the workspace install resolves.
COPY package.json package-lock.json ./
COPY shared/package.json ./shared/
COPY frontend_user/package.json ./frontend_user/
COPY frontend_admin/package.json ./frontend_admin/
COPY frontend_investigator/package.json ./frontend_investigator/
COPY frontend_publisher/package.json ./frontend_publisher/
RUN npm install

# Source (overridden by bind mounts in compose; baked so `docker run` also works).
COPY shared ./shared
COPY frontend_publisher ./frontend_publisher

EXPOSE 5176
CMD ["sh", "-c", "npm install && npm run dev -w frontend_publisher -- --host 0.0.0.0 --port 5176"]
