- Clear /usr/share/caddy/* before copying build output to remove
the default "Caddy works!" index.html from the base image
- Add root redirect: / -> /getting-started/ (permanent)
- Fix try_files to use {path}/index.html for Starlight directories
- Switch MCP healthcheck to TCP socket (GET /mcp returns 406
without proper Accept headers)
28 lines
563 B
Docker
28 lines
563 B
Docker
# --- Base ---
|
|
FROM node:22-slim AS base
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json* ./
|
|
|
|
# --- Dev ---
|
|
FROM base AS dev
|
|
RUN npm ci
|
|
COPY . .
|
|
ENV ASTRO_TELEMETRY_DISABLED=1
|
|
EXPOSE 4321
|
|
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
|
|
|
# --- Build ---
|
|
FROM base AS build
|
|
RUN npm ci
|
|
COPY . .
|
|
ENV ASTRO_TELEMETRY_DISABLED=1
|
|
RUN --mount=type=cache,target=/app/.astro \
|
|
npm run build
|
|
|
|
# --- Prod ---
|
|
FROM caddy:2-alpine AS prod
|
|
RUN rm -rf /usr/share/caddy/*
|
|
COPY --from=build /app/dist /usr/share/caddy
|
|
COPY Caddyfile.prod /etc/caddy/Caddyfile
|
|
EXPOSE 4321
|