Files
njaa-frontend/Dockerfile

24 lines
598 B
Docker

# Stage 1: Build the Astro Site
FROM node:20-alpine AS builder
WORKDIR /app
# Install dependencies strictly
COPY package*.json ./
RUN npm ci
# Copy source files and build the production static files
COPY . .
RUN npm run build
# Stage 2: Serve with Nginx for lightning fast delivery and low memory footprint
FROM nginx:alpine
# Copy the generated static files from the build stage into Nginx
COPY --from=builder /app/dist /usr/share/nginx/html
# Add custom nginx config if we ever need advanced routing, otherwise default works flawlessly for SSG
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]