-react -css this is my personal portfolio, where I introduce myself
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
715 B

6 months ago
  1. # Step 1: Use a base image with Node.js
  2. FROM node:16 AS build
  3. # Step 2: Set the working directory inside the container
  4. WORKDIR /app
  5. # Step 3: Copy package.json and package-lock.json (or yarn.lock)
  6. COPY package*.json ./
  7. # Step 4: Install dependencies
  8. RUN npm install
  9. # Step 5: Copy the rest of your application code
  10. COPY . .
  11. # Step 6: Build the React application
  12. RUN npm run build
  13. # Step 7: Use a base image to serve the application
  14. FROM nginx:alpine
  15. # Step 8: Copy the build output from the previous stage to the Nginx public directory
  16. COPY --from=build /app/build /usr/share/nginx/html
  17. # Step 9: Expose port 80 to the outside
  18. EXPOSE 80
  19. # Step 10: Start the Nginx server
  20. CMD ["nginx", "-g", "daemon off;"]