Skip to content
Snippets Groups Projects
Dockerfile 424 B
Newer Older
  • Learn to ignore specific revisions
  • # Dockerfile for Front-end (React)
    FROM node:14
    
    WORKDIR /app
    
    # Copy package.json and install dependencies
    COPY package*.json ./
    RUN npm install
    
    # Copy the rest of the front-end files
    COPY . .
    
    # Build the React app
    RUN npm run build
    
    # Install 'serve' to serve the React app
    RUN npm install -g serve
    
    # Expose port 80 for the front-end
    EXPOSE 80
    
    # Start the React app on port 80
    CMD ["serve", "-s", "build", "-l", "80"]