From e698a4812f052e75442c2e134dee85883c1f56a1 Mon Sep 17 00:00:00 2001 From: Andreas Hubel Date: Sun, 7 Oct 2018 18:53:38 +0200 Subject: [PATCH] Add docker-compose files [WiP] --- README.md | 14 ++++++++++++++ c3d-graphql/Dockerfile | 12 ++++++++++++ c3d-web/Dockerfile | 20 ++++++++++++++++++++ c3d-web/env.docker | 0 docker-compose.yaml | 28 ++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 c3d-graphql/Dockerfile create mode 100644 c3d-web/Dockerfile create mode 100644 c3d-web/env.docker create mode 100644 docker-compose.yaml diff --git a/README.md b/README.md index f9f5762..e710ecb 100644 --- a/README.md +++ b/README.md @@ -1 +1,15 @@ # c3data + + +## setup + +``` + docker-compose up postgres + docker exec -i c3data_postgres_1 psql c3data < c3d-graphql/schema.sql +``` + +## usage + +``` + docker-compose up c3d-graphql +``` \ No newline at end of file diff --git a/c3d-graphql/Dockerfile b/c3d-graphql/Dockerfile new file mode 100644 index 0000000..9c6158c --- /dev/null +++ b/c3d-graphql/Dockerfile @@ -0,0 +1,12 @@ +FROM node:8.9.0 + +WORKDIR /app + +ENV NODE_ENV=production +#ADD package.json yarn.lock .npmrc /app/ +#RUN unset NODE_ENV; yarn install + +ADD . /app/ + +#RUN yarn build +#CMD npx postgraphile -c postgres:///c3data -w -h 0.0.0.0 -p 5000 diff --git a/c3d-web/Dockerfile b/c3d-web/Dockerfile new file mode 100644 index 0000000..d771403 --- /dev/null +++ b/c3d-web/Dockerfile @@ -0,0 +1,20 @@ +FROM node:8.9.0 + +# ARGUMENT DEFINITION +ARG INSTALL_WATCHMAN=false + +WORKDIR /app + +# INSTALL WATCHMAN +ADD ./scripts /app/scripts/ +RUN if [ "$INSTALL_WATCHMAN" = "true" ] ; then ./scripts/installWatchman.sh ; else echo "watchman installation skipped" ; fi + +# INSTALL NODEJS DEPENDENCIES +ENV NODE_ENV=production +ADD package.json yarn.lock .npmrc /app/ +RUN unset NODE_ENV; yarn install + +ADD . /app/ + +RUN yarn build +CMD yarn start diff --git a/c3d-web/env.docker b/c3d-web/env.docker new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..2f4020e --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,28 @@ +version: '3.4' +services: + c3d-web: + build: + context: ./c3d-web + args: + - INSTALL_WATCHMAN=true + depends_on: ['c3d-graphql'] + volumes: ['./c3d-web:/app'] + env_file: ./c3d-web/env.docker + ports: + - 8080:8080 + links: ['c3d-graphql'] + command: yarn start + c3d-graphql: + build: c3d-graphql + depends_on: ['postgres'] + command: npx postgraphile -c "postgres://graphql:graphql@postgres/c3data" --watch + links: ['postgres'] + ports: ['5000:5000'] + postgres: + image: postgres:10.5 + environment: + - POSTGRES_DB=c3data + - POSTGRES_USER=root + - POSTGRES_PASSWORD=root + volumes: ['./data/postgres:/var/lib/postgresql/data'] + ports: ['5432:5432']