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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:12.22.9
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5000
CMD [ "npm", "start" ]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,14 @@ npm run dev

// Server runs on http://localhost:5000 and client on http://localhost:3000
```
## To Run Using Docker
```bash
#run this command inside project diretory
docker-compose up -d
#run the following command to see logs
docker-compose logs
#run the following the command to stop and delete the containers
docker-compose down
```

For deploying to Heroku, please refer to [this](https://www.youtube.com/watch?v=71wSzpLyW9k) helpful video by TraversyMedia.
3 changes: 3 additions & 0 deletions client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
package.lock.json
yarn.lock
7 changes: 7 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:12.22.9
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm","start"]
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dependencies": {
"axios": "^0.18.0",
"classnames": "^2.2.6",
"is-empty": "^1.2.0",
"jwt-decode": "^2.2.0",
"react": "^16.6.3",
"react-dom": "^16.6.3",
Expand Down
18,404 changes: 9,255 additions & 9,149 deletions client/yarn.lock

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
services:
authserver:
build:
context: ./
dockerfile: Dockerfile
ports:
- "5000:5000"
container_name: auth_server
volumes :
- ./:/app
networks:
- app-network
client:
build:
context: ./client
dockerfile: Dockerfile
container_name: react_client
volumes:
- ./client:/app
ports:
- "3000:3000"
networks:
- app-network
depends_on:
- authserver
networks:
app-network:
driver : bridge

#Remember to change proxy in client package.json file to authserver container name

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"concurrently": "^4.0.1",
"cors": "^2.8.5",
"express": "^4.16.4",
"is-empty": "^1.2.0",
"jsonwebtoken": "^8.3.0",
Expand Down
3 changes: 2 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ const express = require("express");
const mongoose = require("mongoose");
const bodyParser = require("body-parser");
const passport = require("passport");

const cors = require("cors");
const users = require("./routes/api/users");

const app = express();

app.use(cors());
// Bodyparser middleware
app.use(
bodyParser.urlencoded({
Expand Down