33 lines
617 B
Docker
33 lines
617 B
Docker
# Build stage
|
|
FROM node:20.11 as builder
|
|
|
|
# Set working directory
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy package.json and package-lock.json (if available)
|
|
COPY package.json package-lock.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy the rest of the application
|
|
COPY . ./
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Copy the build output to Nginx html directory
|
|
COPY --from=builder /usr/src/app/build /usr/share/nginx/html
|
|
|
|
# Copy Nginx configuration file
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Start Nginx server
|
|
CMD ["nginx", "-g", "daemon off;"]
|