minesweeper-frontend/Dockerfile
2025-01-21 23:51:02 +01:00

32 lines
690 B
Docker

# Use an official node image as the base image
FROM node:20-alpine as build
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package.json package-lock.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Use an official nginx image to serve the app
FROM nginx:alpine
# Copy the build output to the nginx html directory
COPY --from=build /app/dist /usr/share/nginx/html
# Copy nginx configuration file
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]