32 lines
506 B
Docker

# Build stage
FROM node:16-alpine as build
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy project files
COPY . .
# Build the app
RUN npm run build
# Production stage
FROM nginx:alpine
# Copy built files from the build stage
COPY --from=build /app/build /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]