This project is an example of a Dockerized MERN stack application, making it easy to build and run the application in a container.
To build your Docker image, run the following command:
docker build -t mern-app .
Use the following command to run the Docker container while passing environment variables for MongoDB Atlas and any other configuration:
docker run -p 3001:3001 \
-e MONGO_URI="mongodb+srv://<username>:<password>@cluster0.mongodb.net/<dbname>?retryWrites=true&w=majority" \
-e NODE_ENV=production \
mern-app
To stop the running container, first list the running containers:
docker ps
Then stop the container using its container ID:
docker stop <container_id>