# ----------------------------------------------------------------------------
# jb-website — static build served by Caddy with automatic HTTPS.
# Multi-stage: node builds Astro, alpine Caddy serves the result.
# ----------------------------------------------------------------------------

# ---- build stage ------------------------------------------------------------
FROM node:24-alpine AS build
WORKDIR /app

# Install deps separately so they cache between source-only changes.
COPY package.json package-lock.json* ./
RUN npm ci

COPY . .
RUN npm run build

# ---- runtime stage ----------------------------------------------------------
FROM caddy:2-alpine

COPY Caddyfile /etc/caddy/Caddyfile
COPY --from=build /app/dist /srv

# Caddy listens on 80/443; the host's reverse proxy or docker compose maps these.
EXPOSE 80 443
