Files
OSIT-AE-App-Svelte/aether_container_env/Dockerfile.buildkit.example

27 lines
978 B
Docker

## BuildKit-friendly multi-stage Dockerfile example for Aether frontend
# Stage 1: dependencies
FROM node:20-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --no-audit --prefer-offline
# Stage 2: build
FROM node:20-alpine AS build
WORKDIR /app
# optionally reuse deps from previous stage
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# If you want to use BuildKit cache mounts during local development, uncomment the next line
# RUN --mount=type=cache,target=/root/.npm npm ci
RUN npm run build
# Stage 3: runtime (static site served by nginx)
FROM nginx:stable-alpine AS runtime
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
# Notes:
# - Keep dependency installation separate from copying source to maximize cache hits when only application code changes.
# - For backend images, follow the same pattern: install deps early, copy source later, and keep a small final runtime image.