16 lines
452 B
Docker
16 lines
452 B
Docker
# Stage 1: Build the application
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Stage 2: Serve the static files with Nginx
|
|
FROM nginx:alpine
|
|
# Copy the build files from the builder stage to the Nginx web directory
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
# Expose port 80 where the Nginx server runs
|
|
EXPOSE 80
|
|
# Command to start Nginx server
|
|
CMD ["nginx", "-g", "daemon off;"] |