From 22fcdfc49aa6b29f75207b57c1ba677e1df9c419 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 26 Jun 2020 11:49:38 -0400 Subject: [PATCH 1/4] chore: add containerized build and readme instructions --- README.md | 12 ++++++++++++ docker-compose.yml | 25 +++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 4c200c5e6..3661b3f98 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ subproject, e.g. running or testing. - [Branching](#branching) - [Building ToC](#building-toc) - [Building Core UI for Production](#building-core-ui-for-production) + - [Building with a Container](#building-with-a-container) - [Committing](#committing) - [License Checking](#license-checking) @@ -116,6 +117,17 @@ yarn build:production:core Assets are saved to `ui/core/dist/`. +#### Building with a Container + +Optionally, you may build the UI within a container. Execute the +following command: + +```bash +docker-compose run build_production +``` + +Assets are saved to `ui/core/dist/`. + ### Committing Instead of the default `git commit`, we prescribe a custom command that ensures diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..7e97b3e0d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.8' + +services: + node: &node + image: node:12 + volumes: + - './:/src' + - 'icu_node_modules:/src/node_modules' + - 'icu_addon_api_node_modules:/src/addon/api/node_modules' + - 'icu_addon_auth_node_modules:/src/addon/auth/node_modules' + - 'icu_addon_rose_node_modules:/src/addon/rose/node_modules' + - 'icu_ui_core_node_modules:/src/ui/core/node_modules' + working_dir: /src + + build_production: + <<: *node + entrypoint: bash + command: '-c "yarn install && yarn build:production:ui:core"' + +volumes: + icu_node_modules: + icu_addon_api_node_modules: + icu_addon_auth_node_modules: + icu_addon_rose_node_modules: + icu_ui_core_node_modules: diff --git a/package.json b/package.json index 17d23d120..8e18bfe44 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "ui/*" ], "scripts": { - "build:production:core": "cd ui/core && yarn build:production", + "build:production:ui:core": "cd ui/core && yarn build:production", "lint": "yarn lint:addons:api && yarn lint:addons:auth && yarn lint:addons:rose && yarn lint:ui:core", "lint:addons:api": "echo \"\n\nlint: addons/api\n\" && cd addons/api && yarn lint", "lint:addons:auth": "echo \"\n\nlint: addons/auth\n\" && cd addons/auth && yarn lint", From ef8a5d859ba7e61dca6fbd8827f0c0ea8331e9f3 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 26 Jun 2020 11:52:29 -0400 Subject: [PATCH 2/4] docs: fix error in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3661b3f98..ea2dd6027 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ To quickly produce a production build of Core UI, run from this folder: ```bash yarn install -yarn build:production:core +yarn build:production:ui:core ``` Assets are saved to `ui/core/dist/`. From 70abc17fff36cba6516c29916cca1b49e99a1cb0 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 26 Jun 2020 14:15:43 -0400 Subject: [PATCH 3/4] chore: add build script to handle post-build cleanup --- README.md | 2 +- build_production.sh | 4 ++++ docker-compose.yml | 12 ++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) create mode 100755 build_production.sh diff --git a/README.md b/README.md index ea2dd6027..e3951ba65 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ Optionally, you may build the UI within a container. Execute the following command: ```bash -docker-compose run build_production +./build_production.sh ``` Assets are saved to `ui/core/dist/`. diff --git a/build_production.sh b/build_production.sh new file mode 100755 index 000000000..b49e79ce4 --- /dev/null +++ b/build_production.sh @@ -0,0 +1,4 @@ +# /#!/bin/sh + +docker-compose run build_production; +chmod -R 777 ./; diff --git a/docker-compose.yml b/docker-compose.yml index 7e97b3e0d..9bd11664b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,9 +6,9 @@ services: volumes: - './:/src' - 'icu_node_modules:/src/node_modules' - - 'icu_addon_api_node_modules:/src/addon/api/node_modules' - - 'icu_addon_auth_node_modules:/src/addon/auth/node_modules' - - 'icu_addon_rose_node_modules:/src/addon/rose/node_modules' + - 'icu_addons_api_node_modules:/src/addons/api/node_modules' + - 'icu_addons_auth_node_modules:/src/addons/auth/node_modules' + - 'icu_addons_rose_node_modules:/src/addons/rose/node_modules' - 'icu_ui_core_node_modules:/src/ui/core/node_modules' working_dir: /src @@ -19,7 +19,7 @@ services: volumes: icu_node_modules: - icu_addon_api_node_modules: - icu_addon_auth_node_modules: - icu_addon_rose_node_modules: + icu_addons_api_node_modules: + icu_addons_auth_node_modules: + icu_addons_rose_node_modules: icu_ui_core_node_modules: From c9cfa63313f742c373afbc4bd0f136d80fb4c0df Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Fri, 26 Jun 2020 14:35:51 -0500 Subject: [PATCH 4/4] Fix up perms --- build_production.sh | 4 ---- docker-compose.yml => docker-compose-embedding.yml | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100755 build_production.sh rename docker-compose.yml => docker-compose-embedding.yml (70%) diff --git a/build_production.sh b/build_production.sh deleted file mode 100755 index b49e79ce4..000000000 --- a/build_production.sh +++ /dev/null @@ -1,4 +0,0 @@ -# /#!/bin/sh - -docker-compose run build_production; -chmod -R 777 ./; diff --git a/docker-compose.yml b/docker-compose-embedding.yml similarity index 70% rename from docker-compose.yml rename to docker-compose-embedding.yml index 9bd11664b..1cd3d329b 100644 --- a/docker-compose.yml +++ b/docker-compose-embedding.yml @@ -1,3 +1,7 @@ +# Note: this will change the permissions of the files in this directory after +# running to allow for easy deletion, so this should only be run as part of +# watchtower's build task. + version: '3.8' services: @@ -15,7 +19,7 @@ services: build_production: <<: *node entrypoint: bash - command: '-c "yarn install && yarn build:production:ui:core"' + command: '-c "yarn install && yarn build:production:ui:core && chmod -R 777 ."' volumes: icu_node_modules: