Перейти к содержимому

3 Assignment Containerizing a React Application on EC2

syed shabeer

0:00 / 0:00

3 Assignment Containerizing a React Application on EC2

17 просмотров · 2 нед. назад
syed shabeer
5 подписчиков
17 просмотров · 2 нед. назад
https://drive.google.com/drive/folder... sudo apt-get install -y nodejs mkdir react-app-syedshabeer && cd react-app-syedshabeer src/App.js package.json — includes react and react-dom as dependencies public/index.html Dockerfile FROM node:20-alpine AS builder WORKDIR /app COPY package* ./ RUN npm install COPY . . RUN npm run build FROM nginx:1.27-alpine WORKDIR /app RUN rm -rf /usr/share/nginx/html/* COPY --from=builder /app/build /usr/share/nginx/html/ EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] docker build -t nginx:react . docker run -d -p 80:80 --name nignx-react nginx:react curl http://localhost http://your-EC2-public-IP