# Stage 1: Build the frontend FROM node:20 AS builder WORKDIR /app COPY . . RUN npm install RUN npm run build # Stage 2: Serve with nginx FROM nginx:alpine # Install dos2unix RUN apk add --no-cache dos2unix # Copy built app COPY --from=builder /app/dist /usr/share/nginx/html # ✅ Move the env.js.template to separate folder COPY public/env.js.template /etc/env/env.js.template # Copy nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf # Copy entrypoint COPY docker-entrypoint.sh /entrypoint.sh RUN dos2unix /entrypoint.sh && chmod +x /entrypoint.sh EXPOSE 80 ENTRYPOINT ["/entrypoint.sh"] CMD ["nginx", "-g", "daemon off;"]