diff --git a/.gitignore b/.gitignore index d8948dd..810addd 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ htmlcov # georgs pkgs/.vs/ pkgs/clan-cli/.hypothesis/ +ui-assets.tar.gz +ui-release \ No newline at end of file diff --git a/pkgs/clan-cli/README.md b/pkgs/clan-cli/README.md index 9958ec5..a8a107e 100644 --- a/pkgs/clan-cli/README.md +++ b/pkgs/clan-cli/README.md @@ -24,9 +24,8 @@ For Entity object go to - [tests/openapi_client/docs/ResolutionApi.md](tests/openapi_client/docs/ResolutionApi.md) - [tests/openapi_client/docs/RepositoriesApi.md](tests/openapi_client/docs/RepositoriesApi.md) -# Building a Docker Image - -To build a docker image of the frontend and backend be inside the `pkgs/clan-cli` folder and execute: +# Building a Docker Image if the Backend Changed +To build a new docker image when the backend code changed be inside the `pkgs/clan-cli` folder and execute: ```bash nix build .#clan-docker @@ -50,6 +49,20 @@ docker run -p 127.0.0.1:2979:2979 clan-docker:latest ## Docker build with UI changes +To build a new docker image when the frontend code changed you first need +to get the `GITLAB_TOKEN` go to [repo access tokens](https://git.tu-berlin.de/internet-of-services-lab/service-aware-network-front-end/-/settings/access_tokens) and generate one. Then execute +```bash +export GITLAB_TOKEN="" +``` + +Afterwards you can execute: + +```bash +./build_docker.sh +``` + + +### The Script Explained If changes to the UI have been made, and you want them to propagate to the docker container edit the file: [../ui/nix/ui-assets.nix](../ui/nix/ui-assets.nix). This is where a release version of the frontend is downloaded and integrated into the cli and the docker build. To do this first execute @@ -63,11 +76,7 @@ Make a tarball out of it called `ui-assets.tar.gz` tar -czvf ui-assets.tar.gz ui-release/lib/node_modules/clan-ui/out/ ``` -Upload ui-assets.tar.gz to gitlab. To get the `GITLAB_TOKEN` go to [repo access tokens](https://git.tu-berlin.de/internet-of-services-lab/service-aware-network-front-end/-/settings/access_tokens) and generate one. Then execute - -```bash -export GITLAB_TOKEN="" -``` +Upload ui-assets.tar.gz to gitlab. ```bash curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ @@ -121,6 +130,8 @@ Push the image to the git registry docker image push git.tu-berlin.de:5000/internet-of-services-lab/service-aware-network-front-end:latest ``` +# Using the Uploaded Docker Image + Pull the image ```bash diff --git a/pkgs/clan-cli/build_docker.sh b/pkgs/clan-cli/build_docker.sh new file mode 100755 index 0000000..f6efe0e --- /dev/null +++ b/pkgs/clan-cli/build_docker.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +# shellcheck shell=bash +set -euo pipefail + +# GITLAB_TOKEN +if [[ -z "${GITLAB_TOKEN:-}" ]]; then +cat < "$PROJECT_DIR/pkgs/ui/nix/ui-assets.nix" <