From b39dce42cf71ca61b7f4d1716b7123e0bed18d8e Mon Sep 17 00:00:00 2001 From: Michael Matloka Date: Tue, 8 Dec 2020 11:44:39 +0100 Subject: [PATCH] Fix webpack-dev-server inside Docker (#2699) --- bin/docker-dev | 2 +- bin/docker-dev-web | 2 +- bin/docker-frontend | 7 +++++++ {bin => ee/bin}/docker-ch-dev-web | 2 +- ee/docker-compose.ch.yml | 2 +- package.json | 1 + 6 files changed, 12 insertions(+), 4 deletions(-) create mode 100755 bin/docker-frontend rename {bin => ee/bin}/docker-ch-dev-web (53%) diff --git a/bin/docker-dev b/bin/docker-dev index 469a4ee8666..16571cce0b9 100755 --- a/bin/docker-dev +++ b/bin/docker-dev @@ -3,4 +3,4 @@ set -e python manage.py migrate -python manage.py runserver 0.0.0.0:8000 & ./bin/start-worker & ./bin/start-frontend 0.0.0.0 +python manage.py runserver 0.0.0.0:8000 & ./bin/start-worker & ./bin/docker-frontend diff --git a/bin/docker-dev-web b/bin/docker-dev-web index 652242b26cd..b4113b15b89 100755 --- a/bin/docker-dev-web +++ b/bin/docker-dev-web @@ -3,4 +3,4 @@ set -e python manage.py migrate -python manage.py runserver 0.0.0.0:8000 & ./bin/start-frontend 0.0.0.0 +python manage.py runserver 0.0.0.0:8000 & ./bin/docker-frontend diff --git a/bin/docker-frontend b/bin/docker-frontend new file mode 100755 index 00000000000..b170cfcdf49 --- /dev/null +++ b/bin/docker-frontend @@ -0,0 +1,7 @@ +#!/bin/bash +set -e + +export WEBPACK_HOT_RELOAD_HOST="0.0.0.0" + +yarn install +yarn start-docker diff --git a/bin/docker-ch-dev-web b/ee/bin/docker-ch-dev-web similarity index 53% rename from bin/docker-ch-dev-web rename to ee/bin/docker-ch-dev-web index c2113e2e9ab..4c262a9f4e5 100755 --- a/bin/docker-ch-dev-web +++ b/ee/bin/docker-ch-dev-web @@ -4,4 +4,4 @@ set -e python manage.py migrate python manage.py migrate_clickhouse -python manage.py runserver 0.0.0.0:8000 & ./bin/start-frontend 0.0.0.0 +python manage.py runserver 0.0.0.0:8000 & ./bin/docker-frontend diff --git a/ee/docker-compose.ch.yml b/ee/docker-compose.ch.yml index 32d58f9cea6..814370f544b 100644 --- a/ee/docker-compose.ch.yml +++ b/ee/docker-compose.ch.yml @@ -17,7 +17,7 @@ services: build: context: ../ dockerfile: dev.Dockerfile - command: ./bin/docker-ch-dev-web + command: ./ee/bin/docker-ch-dev-web volumes: - ..:/code ports: diff --git a/package.json b/package.json index fcd2205c86d..7c10e1dc62f 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "start": "concurrently -n WEBPACK,TYPEGEN -c blue,green \"yarn run start-http\" \"yarn run typegen:watch\"", "start-http": "mkdir -p frontend/dist/ && cp -a frontend/public/* frontend/dist/ && npm run copy-scripts && webpack-dev-server --hotOnly", "start-https": "mkdir -p frontend/dist/ && cp -a frontend/public/* frontend/dist/ && npm run copy-scripts && webpack-dev-server --hotOnly --https", + "start-docker": "mkdir -p frontend/dist/ && cp -a frontend/public/* frontend/dist/ && npm run copy-scripts && webpack-dev-server --hotOnly --host 0.0.0.0", "build": "echo \"Building Webpack\" && NODE_ENV=production webpack --config webpack.config.js && cp -a frontend/public/* frontend/dist/ && npm run copy-scripts", "prettier": "prettier --write \"./frontend/src/**/*.{js,ts,tsx,json,yml,css,scss}\"", "prettier:check": "prettier --check \"./**/*.{js,ts,tsx,json,yml,css,scss}\"",