From 9b6fc699f2eb4b4469334a93e194c7595b6054b0 Mon Sep 17 00:00:00 2001 From: Luis-Hebendanz Date: Wed, 24 Jan 2024 22:40:11 +0100 Subject: [PATCH] Added push_docker script --- pkgs/clan-cli/README.md | 14 +++++++++++--- pkgs/clan-cli/push_docker.sh | 9 +++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100755 pkgs/clan-cli/push_docker.sh diff --git a/pkgs/clan-cli/README.md b/pkgs/clan-cli/README.md index a8a107e..53ae7dd 100644 --- a/pkgs/clan-cli/README.md +++ b/pkgs/clan-cli/README.md @@ -25,6 +25,7 @@ For Entity object go to - [tests/openapi_client/docs/RepositoriesApi.md](tests/openapi_client/docs/RepositoriesApi.md) # 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 @@ -47,10 +48,11 @@ docker run -p 127.0.0.1:2979:2979 clan-docker:latest [flake-module.nix at line 22](flake-module.nix) - Documentation on `dockerTools.buildImage` you can find here: https://nix.dev/tutorials/nixos/building-and-running-docker-images.html -## Docker build with UI changes +## Building a Docker Image if the Frontend Changed -To build a new docker image when the frontend code changed you first need +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="" ``` @@ -61,8 +63,8 @@ Afterwards you can execute: ./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 @@ -112,6 +114,12 @@ nix build .#clan-docker # Uploading a Docker Image +You can use the script: + +```bash +./push_docker.sh +``` + Login to the tu docker image server ```bash diff --git a/pkgs/clan-cli/push_docker.sh b/pkgs/clan-cli/push_docker.sh new file mode 100755 index 0000000..9d377cc --- /dev/null +++ b/pkgs/clan-cli/push_docker.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# shellcheck shell=bash +set -euo pipefail + +docker login git.tu-berlin.de:5000 +docker load < result +docker image tag clan-docker:latest git.tu-berlin.de:5000/internet-of-services-lab/service-aware-network-front-end:latest +docker image push git.tu-berlin.de:5000/internet-of-services-lab/service-aware-network-front-end:latest \ No newline at end of file