Skip to content

chore: add Dockerfile and docker-compose for local development#52

Open
Jammedat wants to merge 1 commit into
mongodb-developer:mainfrom
Jammedat:main
Open

chore: add Dockerfile and docker-compose for local development#52
Jammedat wants to merge 1 commit into
mongodb-developer:mainfrom
Jammedat:main

Conversation

@Jammedat

Copy link
Copy Markdown

Summary

This PR containerizes the MERN stack application using Docker and Docker Compose. It allows developers to spin up the entire local development environment (Frontend, Backend, and MongoDB) with a single command without needing to install dependencies locally.

Changes Made

  • Added Dockerfile for the React frontend (multi-stage build).
  • Added Dockerfile for the Node.js/Express backend.
  • Created a root-level docker-compose.yml file to orchestrate the services and the MongoDB database.
  • Configured environment variables to ensure seamless local network communication between containers.

How to Test Locally

  1. Clone this repo
  2. Ensure you have docker installed and running.
  3. Change the directory to mern
  4. Run the following command inside directory:
    docker-compose up -d --build
  5. Access the application in your browser:
    • Frontend: http://localhost:3000
    • Backend API: http://localhost:5050

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant