You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
510 B
Docker

# Stage 1: Build
FROM node:20-alpine AS builder
WORKDIR /app
# Install dependencies first (layer caching)
COPY package.json ./
RUN npm install
# Copy source and build
COPY . .
RUN npm run build
# Stage 2: Serve
FROM nginx:alpine
# Remove default nginx config
RUN rm /etc/nginx/conf.d/default.conf
# Copy custom nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy built assets from builder
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]