Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions .github/workflows/main.yaml

This file was deleted.

32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# A simple MERN stack application

**Note** - To run this project using `docker compose`, follow the below steps.

Switch to the `compose` branch to learn the

1. Implementation of `Dockerfile` for `client` and `server`.
2. Run the containers using `Docker Compose`.

## Run it local without Docker

### Prerequisite

- Install `npm`

#### Start Server:

```
cd mern/server
npm install
npm start
```

#### Start Client

```
cd mern/client
npm install
npm run dev
```

<img width="1790" alt="Screenshot 2024-08-31 at 11 07 58 PM" src="https://github.com/user-attachments/assets/f414230b-8bd6-4393-b8de-6a10444a8dfd">
3 changes: 1 addition & 2 deletions mern/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ COPY . .

EXPOSE 5050

CMD ["npm", "start"]

CMD ["npm","start"]
7 changes: 3 additions & 4 deletions docker-compose.yaml → mern/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
backend:
build: ./mern/backend
build: C:/Users/Reshma/MERN-docker-compose/mern/backend
ports:
- "5050:5050"
networks:
Expand All @@ -11,7 +11,7 @@ services:
- mongodb

frontend:
build: ./mern/frontend
build: C:/Users/Reshma/MERN-docker-compose/mern/frontend
ports:
- "5173:5173"
networks:
Expand All @@ -34,5 +34,4 @@ networks:

volumes:
mongo-data:
driver: local # Persist MongoDB data locally

driver: local
16 changes: 3 additions & 13 deletions mern/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
# Use the official image as a parent image
# Description: Dockerfile for the client side of the MERN stack application

# Use the official image as a parent image
FROM node:18.9.1

# Set the working directory
WORKDIR /app

# Copy the file from your host to your current location
COPY package.json .

# Run the command inside your image filesystem
RUN npm install

# Inform Docker that the container is listening on the specified port at runtime
EXPOSE 5173

# Copy the rest of your app's source code from your host to your image filesystem
COPY . .

# Run the specified command within the container
CMD ["npm", "run", "dev"]
EXPOSE 5173

CMD ["npm","run","dev"]