Skip to content

Commit

Permalink
Add Docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
otttooming committed Mar 5, 2019
1 parent 939890e commit 761e952
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
*Dockerfile*
*docker-compose*
*/node_modules
16 changes: 16 additions & 0 deletions Dockerfile.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:10.15.0

ARG PACKAGE_PATH=
ARG WORKING_DIR=

WORKDIR ${WORKING_DIR}

COPY ${PACKAGE_PATH}/package*.json ${WORKING_DIR}

RUN yarn install

COPY ${PACKAGE_PATH} ${WORKING_DIR}

VOLUME $WORKING_DIR/node_modules

CMD [ "yarn", "start" ]
Empty file added common.env
Empty file.
45 changes: 45 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: '3.5'

services:
api:
build:
context: .
dockerfile: Dockerfile.node
args:
PACKAGE_PATH: packages/healthvet-server
WORKING_DIR: /usr/src/
expose:
- 4000
ports:
- 4000:4000
environment:
- NODE_ENV=development
env_file:
- ./common.env
volumes:
- ./packages/healthvet-server:/usr/src
command: ['yarn', 'start:docker']

frontend:
build:
context: .
dockerfile: Dockerfile.node
args:
PACKAGE_PATH: packages/healthvet-front
WORKING_DIR: /usr/src/
expose:
- 3000
ports:
- 3000:3000
environment:
- REACT_APP_ENV=development
- BACKEND=api:4000
- HTTPS=true
- NODE_PATH=/usr/src/
env_file:
- ./common.env
volumes:
- ./packages/healthvet-front:/usr/src
depends_on:
- api
command: ['yarn', 'start:docker']
1 change: 1 addition & 0 deletions packages/healthvet-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"scripts": {
"start": "react-scripts start",
"start:docker": "yarn install && yarn run start",
"build": "react-scripts build",
"generate": "gql-gen",
"test": "react-scripts test",
Expand Down
1 change: 1 addition & 0 deletions packages/healthvet-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"license": "MIT",
"scripts": {
"start": "ts-node src/index.ts",
"start:docker": "yarn install && yarn run start",
"generate": "graphqlgen"
},
"dependencies": {
Expand Down

0 comments on commit 761e952

Please sign in to comment.