Files
learning-platform/Dockerfile

29 lines
587 B
Docker

# Stage 1: Build the React application
FROM node:22-alpine as build
WORKDIR /app
# Copy package files and install dependencies
COPY package*.json ./
RUN npm install
# Copy the rest of the application files
COPY . .
# Build the Vite project for production
RUN npm run build
# Stage 2: Serve the application with Nginx
FROM nginx:alpine
# Copy custom Nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy the build output to Nginx's html directory
COPY --from=build /app/dist /usr/share/nginx/html
# Expose port 80
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]