Skip to content

Commit

Permalink
Moved webapp and api to different dirs for containerization. Added do…
Browse files Browse the repository at this point in the history
…ckerfiles and updated docker-compose.yml
  • Loading branch information
Esben Gade Hellmuth committed Feb 19, 2020
1 parent f3067e5 commit f842382
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,6 @@ dmypy.json
.pyre/

.idea/
node_modules/
webapp/node_modules/
webapi/node_modules/
package-lock.json
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
version: '3'
services:
webapp:
build: ./webapp
container_name: webapp
restart: unless-stopped
network_mode: host
volumes:
- /tmp:/tmp
command:
"node minitwit.js"
api:
build: webapi
container_name: webapi
restart: unless-stopped
network_mode: host
volumes:
- /tmp:/tmp
command:
"node minitwit-api.js"
nginx:
image: nginx:1.17
container_name: reverse-proxy
Expand Down
3 changes: 3 additions & 0 deletions webapi/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
npm-debug.log

15 changes: 15 additions & 0 deletions webapi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Start image
FROM node:11

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install

# Bundle app source
COPY . .
File renamed without changes.
16 changes: 16 additions & 0 deletions webapi/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "minitwit",
"version": "0.0.1",
"description": "Minitwit.py refactor in Nodejs/Express",
"main": "minitwit.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"sqlite3": "^4.1.1",
"body-parser": "latest"
}
}
3 changes: 3 additions & 0 deletions webapp/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
npm-debug.log

15 changes: 15 additions & 0 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Start image
FROM node:11

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install

# Bundle app source
COPY . .
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f842382

Please sign in to comment.