lượt xem: 163
# Stage 1: Build Image FROM node:bookworm-slim AS build WORKDIR /app # Copy only package.json and package-lock.json initially to leverage Docker layer caching COPY package*.json ./ RUN npm config set registry http://registry.npmjs.org/ RUN export NODE_OPTIONS=--max-old-space-size=8192 && npm install # Copy the entire project and build COPY . . RUN npm run build # Stage 2: Production Image FROM nginx:alpine # Copy built files from the build stage COPY --from=build /app/dist /usr/share/nginx/html/ COPY --from=build /app/config/default.conf /etc/nginx/conf.d/ # Set the working directory WORKDIR /usr/share/nginx/html/ # Expose port 80 EXPOSE 80 # Start the Nginx web server CMD ["nginx", "-g", "daemon off;"]