-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

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