# --- Build stage: install deps and compile the SvelteKit app --- FROM node:22-alpine AS build WORKDIR /app # Install dependencies first (better layer caching) COPY package.json package-lock.json* ./ RUN npm ci # Build the app COPY . . RUN npm run build # Drop dev dependencies so the runtime image stays small RUN npm prune --omit=dev # --- Runtime stage: just Node + the built server --- FROM node:22-alpine AS runtime WORKDIR /app ENV NODE_ENV=production COPY --from=build /app/build ./build COPY --from=build /app/node_modules ./node_modules COPY --from=build /app/package.json ./package.json EXPOSE 3000 CMD ["node", "build"]