This repository contains a Dockerized MERN (MongoDB, Express, React, Node.js) stack application. It consists of three main components:
- Frontend: React-based user interface.
- Backend: Express-based API server.
- MongoDB: Database server.
To run this application using Docker, follow these steps:
- Docker installed on your machine.
- Docker Compose installed (optional but recommended for managing multi-container setups).
Before running the containers, pull the Docker images from Docker Hub:
docker pull tanmaykumarchaurasia/portfolio-frontend
docker pull tanmaykumarchaurasia/portfolio-backend
docker pull tanmaykumarchaurasia/mongo
-
Run MongoDB Container:
docker run -d \ --name mongo \ -p 27017:27017 \ tanmaykumarchaurasia/mongo
-
Run Backend Container:
docker run -d \ --name backend \ -p 8000:8000 \ tanmaykumarchaurasia/portfolio-backend
-
Run Frontend Container:
docker run -d \ --name frontend \ -p 3000:3000 \ tanmaykumarchaurasia/portfolio-frontend
- Frontend: Open your web browser and navigate to
http://localhost:3000
. - Backend API: Access the backend at
http://localhost:8000
.
To simplify the process, you can use Docker Compose to manage all the containers:
-
Create a
docker-compose.yml
file:version: '3' services: mongo: image: tanmaykumarchaurasia/mongo ports: - "27017:27017" backend: image: tanmaykumarchaurasia/portfolio-backend ports: - "8000:8000" depends_on: - mongo frontend: image: tanmaykumarchaurasia/portfolio-frontend ports: - "3000:3000" depends_on: - backend
-
Run Docker Compose:
docker-compose up -d
To stop the running containers, use:
docker stop mongo backend frontend