Skip to content

Commit

Permalink
updated dockerfilke and updated readme.md
Browse files Browse the repository at this point in the history
Signed-off-by: Ratan Gulati <[email protected]>
  • Loading branch information
Ratangulati committed Jul 12, 2024
1 parent c4294c4 commit 52fc182
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 9 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,54 @@ Contributions are welcome! If you have any ideas, suggestions, or bug fixes, ple

## 📦 Installation

### With Docker

You can clone the project directly from this repo to your local system.

### 1. Clone the Repo

```bash
git clone https://github.com/username/Devlabs.git
```

### 2. Navigate to the project directory

```bash
cd Devlabs
```

### 3. Create Backend Environment

```bash
MONGODB_URI=<mongodb connection uri for the database>
PORT=<port number on which backend is running>
FRONTEND_URL=<url of the frontend>
MAIL=<email from which to send mail to self>
PASSWORD=<passkey corresponding to above mail>
```

### 4. Create Frontend Environment

All the environment variables for react must be prefixed with `REACT_APP_`.

```bash
REACT_APP_BACKEND=<url of the backend>
```


### 5. Run Docker Compose

```bash
docker-compose up --build
```

You have to use build for the first time only then you can use `docker-compose up`

Now follow all the steps from point 6 of without docker to contribute to the project.


### Without Docker

You can clone the project directly from this repo to your local system.

### 1. Clone the Repo
Expand Down
9 changes: 2 additions & 7 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
FROM node:alpine AS builder
FROM node:alpine
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .

FROM node:alpine
WORKDIR /app
COPY --from=builder /app /app
RUN npm install
EXPOSE 8000
CMD ["npm","start"]
CMD ["npm", "start"]
14 changes: 13 additions & 1 deletion compose.yaml → docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,16 @@ services:
ports:
- "8000:8000"
env_file:
- ./backend/.env
- ./backend/.env
depends_on:
- mongo

mongo:
image: mongo:latest
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db

volumes:
mongo-data:
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ WORKDIR /app
COPY --from=builder /app /app
RUN npm install
EXPOSE 3000
CMD ["npm","start"]
CMD ["npm", "start"]

0 comments on commit 52fc182

Please sign in to comment.