# --- Build stage: produce static dist/ --- FROM node:22-alpine AS build WORKDIR /app # Install deps against the lockfile for reproducible builds. COPY package.json package-lock.json* ./ RUN npm ci COPY . . # PUBLIC_* env vars are inlined at build time. In Coolify, set them as # build-time variables so analytics is baked into the static output. RUN npm run build # --- Runtime stage: serve dist/ with Caddy --- FROM caddy:2-alpine AS runtime COPY Caddyfile /etc/caddy/Caddyfile COPY --from=build /app/dist /srv EXPOSE 80