node:22 ships npm 10, which rejects the npm-11-generated package-lock
("Missing: @emnapi/core"). Upgrade npm to 11 before npm ci.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
25 lines
834 B
Docker
25 lines
834 B
Docker
# --- Build stage: produce static dist/ ---
|
|
# Debian (glibc), not alpine: Astro 7's Rust toolchain (rolldown/oxc) resolves
|
|
# cleanly against the linux-x64-gnu lockfile entries.
|
|
FROM node:22-slim AS build
|
|
WORKDIR /app
|
|
|
|
# The lockfile is generated by npm 11; node:22 ships npm 10, which rejects it
|
|
# ("Missing: @emnapi/core ..."). Match the generator before installing.
|
|
RUN npm install -g npm@11
|
|
|
|
# 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
|