service-template-react/Dockerfile
nholtware 9fd6fd1d26 feat: initial Vite/React frontend service template
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 02:27:23 -06:00

17 lines
667 B
Docker

# Build stage: Vite -> static dist/. GIT_SHA is passed by the build-push action.
FROM node:22.23.4-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
ARG GIT_SHA=dev
ENV VITE_GIT_SHA=${GIT_SHA}
RUN npx vite build
# Runtime stage: static files only, no Node. Runs as uid 101, listens on 8080.
FROM nginxinc/nginx-unprivileged:1.31.7-alpine
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --chmod=0755 docker-entrypoint.d/10-config.sh /docker-entrypoint.d/10-config.sh
# html dir owned by nginx so 10-config.sh can write config.js at start.
COPY --from=build --chown=101:101 /app/dist /usr/share/nginx/html
EXPOSE 8080