From db724e7834e5c65186ef1bdfa206cb1cecc132c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Sat, 8 Dec 2018 12:40:34 +0100 Subject: [PATCH 1/4] Split development config from production config in `docker-compose.yml` and `docker-compose.override.yml`. This should speed up builds e.g. on Travis CI, which does not need to sync folders or run `yarn run dev` if the docker image was built recently. Also it should make the build more reliable as it behaves more similar to our deployment. --- docker-compose.override.yml | 11 +++++++++++ docker-compose.yml | 8 ++------ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 docker-compose.override.yml diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 000000000..1f35305b6 --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,11 @@ +version: '3.7' + +services: + webapp: + volumes: + - .:/HC-WebApp + - node_modules:/HC-WebApp/node_modules + command: yarn run dev + +volumes: + node_modules: diff --git a/docker-compose.yml b/docker-compose.yml index af6ad1cb7..f7c697889 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,17 +2,13 @@ version: '3.7' services: webapp: - build: - context: . + image: humanconnection/nitro-web:latest + build: . ports: - 3000:3000 - 8080:8080 networks: - hc-network - volumes: - - .:/HC-WebApp - - node_modules:/HC-WebApp/node_modules - command: yarn run dev environment: - HOST=0.0.0.0 - BACKEND_URL=http://backend:4000 From d4d0eb88cf369d5afa71faf04dc29d6aa8c1385d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Sat, 8 Dec 2018 15:45:16 +0100 Subject: [PATCH 2/4] Fix wrong folder names @appinteractive same same, git-grep is your friend --- docker-compose.override.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 1f35305b6..bf4d42841 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -3,8 +3,8 @@ version: '3.7' services: webapp: volumes: - - .:/HC-WebApp - - node_modules:/HC-WebApp/node_modules + - .:/nitro-web + - node_modules:/nitro-web/node_modules command: yarn run dev volumes: From da498b28f01245a6c7985f5e916c1054c0f0e018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Sat, 8 Dec 2018 23:12:55 +0100 Subject: [PATCH 3/4] Volume for styleguide dependencies Otherwise you would have to install dependencies on your host system which is bad practice. --- docker-compose.override.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index bf4d42841..4188b42ce 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -5,7 +5,9 @@ services: volumes: - .:/nitro-web - node_modules:/nitro-web/node_modules + - node_modules_styleguide:/nitro-web/styleguide/node_modules command: yarn run dev volumes: node_modules: + node_modules_styleguide: From 2fcbdcb436dffd8d4563ffcfbcb5115a23e2b63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Sat, 8 Dec 2018 23:15:22 +0100 Subject: [PATCH 4/4] Fix refresh bug This misconfiguration doesn't produce a bug without the docker environment. Better to use docker also for development. Let's make it the single source of truth. --- plugins/apollo-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/apollo-config.js b/plugins/apollo-config.js index 7d0ae7564..5c9c3632e 100644 --- a/plugins/apollo-config.js +++ b/plugins/apollo-config.js @@ -1,5 +1,5 @@ export default function({ app }) { - const backendUrl = process.BACKEND_URL || 'http://localhost:4000' + const backendUrl = process.env.BACKEND_URL || 'http://localhost:4000' return { httpEndpoint: process.server ? backendUrl : '/api', httpLinkOptions: {