# Dev image for the admin/council 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 three are needed so the workspace
# install resolves; only the admin app + shared source are baked below.
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_admin ./frontend_admin

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