Dockerizing and Deploying a React App
01 Jun 2025
A compact workflow to build, push, and run your frontend image with Docker Hub.
1. Create Dockerfile
FROM node:18-alpine AS builderWORKDIR /appCOPY package*.json ./RUN npm installCOPY . .RUN npm run build
2. Build image
docker build -t sabberrahman/frontend_dashboard:latest .
3. Push image
docker push sabberrahman/frontend_dashboard:latest
4. Pull and run
docker pull sabberrahman/frontend_dashboard:latestdocker run -p 80:80 sabberrahman/frontend_dashboard:latest