# Stage 1: Build the application FROM node:18-alpine AS build WORKDIR /app # Copy package files and install dependencies COPY package*.json ./ RUN npm install # Copy the rest of the application source code COPY . . # Run the 'build' script RUN npm run build # Stage 2: Serve the application with Nginx FROM nginx:stable-alpine # Copy the built assets from the 'build' stage COPY --from=build /app/dist /usr/share/nginx/html # Copy custom Nginx configuration COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port 7860 and start Nginx EXPOSE 7860 CMD ["nginx", "-g", "daemon off;"]