# syntax=docker/dockerfile:1 # ---- Build stage ------------------------------------------------------- FROM node:22-alpine AS build WORKDIR /app # Install dependencies against the lockfile first (better layer caching). COPY package.json package-lock.json ./ RUN npm ci # Build the static site. `prebuild` fetches a PokéAPI snapshot into # src/data/snapshot.json — if that file is already present and fresh it is # reused, otherwise this stage needs network access to pokeapi.co. # Serving under a sub-path? Pass --build-arg BASE_PATH=/subdir/. COPY . . ARG BASE_PATH=/ ENV BASE_PATH=${BASE_PATH} RUN npm run build # ---- Runtime stage --------------------------------------------------- FROM nginx:1.27-alpine AS runtime COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80 # The base image's CMD already runs: nginx -g 'daemon off;'