# Build stage FROM node:20-alpine as builder WORKDIR /app # Enable corepack and set up Yarn 4.8.0 before copying files RUN corepack enable RUN corepack prepare yarn@4.8.0 --activate # Copy package files COPY package.json yarn.lock ./ RUN yarn install # Copy source files COPY . ./ # Build the application RUN yarn build # Production stage FROM nginx:alpine # Create SSL directory RUN mkdir -p /etc/nginx/ssl # Copy nginx configuration COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf # Copy built files from builder COPY --from=builder /app/dist /usr/share/nginx/html # Start nginx CMD ["nginx", "-g", "daemon off;"]