# Build-only image for the Vue frontend. # It is never run as a service: ansible builds this image once, runs it # with the host output directory bind-mounted at /output, the container # copies the compiled static build into it, and exits. Nginx on the host # then serves that directory directly. FROM node:20-alpine AS build WORKDIR /app # The build context here is just frontend/ (no .git), so vite.config.js's # own `git rev-parse` fallback can't find a repo - the actual commit is # passed in from the real checkout via this build-arg instead (see # playbook.yml). ARG GIT_COMMIT=unknown ENV GIT_COMMIT=$GIT_COMMIT COPY package.json package-lock.json ./ COPY extras/ ./extras/ RUN npm ci COPY . . RUN npm run build FROM alpine AS export COPY --from=build /app/dist /dist VOLUME /output CMD ["sh", "-c", "rm -rf /output/* && cp -a /dist/. /output/"]