Base images now come from public.ecr.aws instead of docker.io, whose anonymous pull quota kept failing Coolify builds. bun stays the local dev toolchain; the image build uses npm + the existing package-lock.json.
30 lines
925 B
Docker
30 lines
925 B
Docker
# Base image from AWS ECR Public (mirror of the Docker Official node image).
|
|
# Avoids Docker Hub's anonymous pull rate limits on build servers.
|
|
ARG NODE_IMAGE=public.ecr.aws/docker/library/node:22-alpine
|
|
|
|
# --- Build stage: install deps and build the Astro SSR bundle
|
|
FROM ${NODE_IMAGE} AS build
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --ignore-scripts --no-audit --no-fund
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# --- Deps stage: production-only node_modules for the runtime
|
|
FROM ${NODE_IMAGE} AS deps
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --omit=dev --ignore-scripts --no-audit --no-fund
|
|
|
|
# --- Runtime stage: Astro Node standalone server
|
|
FROM ${NODE_IMAGE}
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production \
|
|
HOST=0.0.0.0 \
|
|
PORT=4321
|
|
COPY --from=build /app/dist ./dist
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY package.json ./
|
|
EXPOSE 4321
|
|
CMD ["node", "dist/server/entry.mjs"]
|