From 873ef3094f8a11e1d80f2a3e6ae7252682322820 Mon Sep 17 00:00:00 2001 From: mitch Date: Tue, 27 Apr 2021 16:28:22 -0500 Subject: [PATCH 1/3] src copy to container handled by volumes map now --- docker-compose.yml | 2 ++ hack/Dockerfile-dev | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4cc6749..be195fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,8 @@ services: WEBSSH2_LOCATION: 'http://127.0.0.1:8081' ports: - "8080:80" + volumes: + - './src:/usr/share/nginx/html' # WebSSH2 is also required for terminal functionality - provides a websocket-to-ssh proxy for the front-end webssh2: image: "antidotelabs/webssh2:ping-timeout" diff --git a/hack/Dockerfile-dev b/hack/Dockerfile-dev index f5bd550..68c7c45 100644 --- a/hack/Dockerfile-dev +++ b/hack/Dockerfile-dev @@ -4,6 +4,5 @@ # the provided Makefile ("make hack") FROM nginx -COPY src/ /usr/share/nginx/html COPY launch.sh / CMD ["/launch.sh"] From e689f22725dbaaabcb7882ef68d38ce59d4d825e Mon Sep 17 00:00:00 2001 From: mitch Date: Fri, 30 Apr 2021 10:55:09 -0500 Subject: [PATCH 2/3] add dev startup scripts --- src/package.json | 4 ++++ src/scripts/dev.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100755 src/scripts/dev.sh diff --git a/src/package.json b/src/package.json index ad23fd2..7b7d176 100644 --- a/src/package.json +++ b/src/package.json @@ -16,6 +16,10 @@ "rollup-plugin-terser": "^5.1.3" }, "scripts": { + "dev": "CLEAN_INSTALL=true COMPOSE_UP=true sh scripts/dev.sh", + "dev:up": "COMPOSE_UP=true sh scripts/dev.sh", + "dev:down": "COMPOSE_DOWN=true sh scripts/dev.sh", + "dev-restart": "COMPOSE_RESTART=true sh scripts/dev.sh", "build": "npx rollup -c", "watch": "npx rollup -cw", "test": "echo \"Error: no test specified\" && exit 1" diff --git a/src/scripts/dev.sh b/src/scripts/dev.sh new file mode 100755 index 0000000..e24074f --- /dev/null +++ b/src/scripts/dev.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# set -x # this line will enable debugs +ANTIDOTE_WEB_ENV=mock +export ANTIDOTE_WEB_ENV +if [ "$CLEAN_INSTALL" == "true" ]; then + # install deps + cd ../src + npm install + # This links the above antidote-ui-components into the src/node_modules directory + npm link ../../antidote-ui-components + # Cleanup + rm -rf advisor/ labs/ stats/ collections/ catalog/ + # Set up for a clean build + mkdir -p advisor/ labs/ stats/ collections/ catalog/ + cd ../templates + # Create the virtual python environment 'venv' + virtualenv venv/ + # Activate the virtual environment + source venv/bin/activate + pip install jinja2 + python generate_webapp.py + # Leave the virtual environment + deactivate +fi +if [ "$COMPOSE_UP" == "true" ]; then + docker-compose build --no-cache + docker-compose up -d + echo "Cluster started. Run 'docker-compose logs' to see log output." +fi +if [ "$COMPOSE_DOWN" == "true" ]; then + docker-compose down +fi +if [ "$COMPOSE_RESTART" == "true" ]; then + docker-compose down + docker-compose build --no-cache + docker-compose up -d + echo "Cluster started. Run 'docker-compose logs' to see log output." +fi From 26c30a72eb0f0e7c6dbf2fdc6cd9be6ec696f2e1 Mon Sep 17 00:00:00 2001 From: mitch Date: Fri, 30 Apr 2021 14:23:15 -0500 Subject: [PATCH 3/3] update comment to reflect new dev.sh script --- hack/Dockerfile-dev | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hack/Dockerfile-dev b/hack/Dockerfile-dev index 68c7c45..bacbc2c 100644 --- a/hack/Dockerfile-dev +++ b/hack/Dockerfile-dev @@ -1,7 +1,6 @@ # This is a DEVELOPMENT dockerfile, and therefore includes no npm build -# steps. It is assumed this has already been run, and therefore needs only -# a webserver. It is also not meant to be built directly, but rather through -# the provided Makefile ("make hack") +# steps. The build steps are accomplished by the dev.sh script in the +# /src/scripts directory. FROM nginx COPY launch.sh /