back to alpine image
All checks were successful
Build and Deploy Container / build_and_deploy (push) Successful in 1m23s

This commit is contained in:
Clemens Hering
2025-11-11 06:33:37 +01:00
parent f3984f8b57
commit c5b66c4298

View File

@@ -1,34 +1,26 @@
########### # Multi-stage build for Astro static site
# BUILD STAGE FROM node:22-alpine AS builder
###########
FROM cgr.dev/chainguard/node:latest-dev AS build
WORKDIR /app WORKDIR /app
# Copy dependency manifests # Install deps
COPY package*.json ./ COPY package*.json ./
RUN npm ci || npm install
# Install all deps (inkl. dev) # Copy sources and build static output
RUN --mount=type=cache,target=/root/.npm npm install && npm ci
# Copy app source and build
COPY . . COPY . .
RUN npm run build RUN npm run build
########### # ---- Runtime stage ----
# RUNTIME STAGE FROM node:22-alpine AS runtime
###########
FROM cgr.dev/chainguard/node:latest
ENV NODE_ENV=production
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production
# Copy only whats needed to run ENV PORT=3000
COPY --from=build /app/package*.json ./ ENV WEB_ROOT=/app/dist
COPY --from=build /app/node_modules ./node_modules ENV TZ=Europe/Berlin
COPY --from=build /app/dist ./dist ENV ASTRO_TELEMETRY_DISABLED=1
COPY --from=build /app/server.mjs ./server.mjs COPY --from=builder /app/dist /app/dist
COPY server.mjs /app/server.mjs
# Chainguard runs as nonroot by default (user `nonroot`) # Drop root: use the pre-created node user
USER nonroot USER node
#EXPOSE 3000 #EXPOSE 3000
CMD ["node", "/app/server.mjs"]
CMD ["node", "./server.mjs"]