Astro 6.x requires Node >=22.12.0. The previous Dockerfile used node:20-alpine, which the Astro CLI rejected with: Node.js v20.20.2 is not supported by Astro! Please upgrade Node.js to a supported version: ">=22.12.0" EasyPanel pulled the change, ran the build, and failed at `RUN npm run build`. Bumping to node:22-alpine fixes it. Also added two 'common failure' sections to docs/ci-setup.md covering the nixpacks 'No start command' and Node version mismatch errors we just hit.
30 lines
800 B
Docker
30 lines
800 B
Docker
# =====================================================================
|
|
# Stage 1: Build the Astro static site
|
|
# =====================================================================
|
|
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install deps with cache layer
|
|
COPY package*.json ./
|
|
RUN npm ci --no-audit --no-fund
|
|
|
|
# Build
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# =====================================================================
|
|
# Stage 2: Serve with nginx
|
|
# =====================================================================
|
|
FROM nginx:1.27-alpine
|
|
|
|
# Astro outputs to ./dist by default
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# nginx config: SPA-friendly, gzip, cache headers for static assets
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|