# syntax=docker/dockerfile:1
# Multi-stage build for the Astro Node-adapter SERVER build (standalone).
# No secrets are baked in — .env is supplied at runtime, never copied into the image.

# ---- build stage ----
FROM node:lts-slim AS build
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
COPY . .
RUN npm run build

# ---- runtime stage ----
FROM node:lts-slim AS runtime
WORKDIR /app
ENV NODE_ENV=production \
    HOST=0.0.0.0 \
    PORT=4321
COPY package.json package-lock.json* ./
RUN npm ci --omit=dev && npm cache clean --force
COPY --from=build /app/dist ./dist
USER node
EXPOSE 4321
CMD ["node", "./dist/server/entry.mjs"]
