Skip to content

Commit

Permalink
Finalize Docker stuff for:
Browse files Browse the repository at this point in the history
  • Loading branch information
unixhelden committed Jul 14, 2018
1 parent da173be commit 3051822
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Nginx/conf.d/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ server {
access_log off;

location / {
proxy_pass http://backend:8080;
proxy_pass http://frontend:8080;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ FocusBlock uses a Node.js server in order to handle communication between the cl

Start by creating a `.env` file that will store these properties:

- `BASE_PATH`=localhost:3000
- `DB_PATH`=mongodb://localhost:27017/focusblock
- `BASE_PATH`=localhost
- `PORT`=3000
- `DB_HOST`=localhost:27017
- `DB_NAME`=focusblock

##### Start Server
Expand Down
5 changes: 5 additions & 0 deletions Server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
.gitignore
README.md
docker-compose.yml
node_modules
16 changes: 16 additions & 0 deletions Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:8-slim

RUN mkdir /app

RUN npm install nodemon -g

WORKDIR /app
COPY . .
#ADD . .

RUN npm install


EXPOSE 3000

CMD npm start
6 changes: 6 additions & 0 deletions Server/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"env": {
"NODE_ENV": "development"
},
"ext": "js json hjs"
}
61 changes: 61 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: '3'
services:
nginx:
container_name: focusblock-nginx
image: nginx:latest
#restart: always
ports:
- "80:80"
volumes:
- ./Nginx/conf.d:/etc/nginx/conf.d
links:
- frontend
depends_on:
- frontend

mongodb:
container_name: focusblock-mongodb
image: mongo:latest
command: mongod --storageEngine=wiredTiger
ports:
- "27017:27017"
volumes:
- ./MongoDB:/data/db

backend:
container_name: focusblock-backend
build: ./Server
restart: on-failure
environment:
BASE_PATH: localhostxs
DB_HOST: mongodb:27017
DB_NAME: focusblock
PORT: 3000
#volumes:
# - ./Server:/app
ports:
- "3000:3000"
links:
- mongodb
depends_on:
- mongodb

frontend:
container_name: focusblock-frontend
build: "./focus-block"
environment:
#SMTP Username for SMTPJS (From Sengrid)
REACT_APP_SMTP_USERNAME: CHANGE_ME
#SMTP Password for SMTPJS (From Sengrid)
REACT_APP_SMTP_PW: CHANGE_ME_TOO
#The route for your Node Server (ex. http://localhost:8000)
REACT_APP_API_BASE: http://backend:3000
PORT: 8080
#volumes:
# - ./focus-block:/app
ports:
- "8080:8080"
links:
- backend
depends_on:
- backend
5 changes: 5 additions & 0 deletions focus-block/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
../Server/.gitignore
README.md
docker-compose.yml
node_modules
13 changes: 13 additions & 0 deletions focus-block/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:8-slim

RUN mkdir /app
RUN npm install npm-run-all -g

WORKDIR /app
COPY . .
#ADD . .
RUN npm install

EXPOSE 8080

CMD npm start

0 comments on commit 3051822

Please sign in to comment.