# 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 ./ COPY whisperlive-frontend/package.json ./whisperlive-frontend/ # Now run yarn install RUN yarn install # Copy source files COPY whisperlive-frontend ./whisperlive-frontend # Build the application RUN yarn workspace whisperlive-frontend build # Production stage FROM nginx:alpine # Create SSL directory RUN mkdir -p /etc/nginx/ssl # Create a win/macos switcher ARG BUILD_OS ENV BUILD_OS=${BUILD_OS} ARG NGINX_MODE ENV NGINX_MODE=${NGINX_MODE} # Copy nginx configuration COPY whisperlive-frontend/nginx/nginx-${BUILD_OS}-${NGINX_MODE:-dev}.conf /etc/nginx/conf.d/default.conf # Copy built files from builder COPY --from=builder /app/whisperlive-frontend/dist /usr/share/nginx/html # Start nginx CMD ["nginx", "-g", "daemon off;"]