From 10c5581313c7b7cc45987d6bc02ad0755bd03e9a Mon Sep 17 00:00:00 2001 From: Armin <armin.co@hs-bochum.de> Date: Wed, 10 Jun 2020 11:34:35 +0200 Subject: [PATCH] Save image build log into build.log --- .gitignore | 3 ++- build_mumble_web.sh | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 86ffe62..267d1b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ dist/ -mumble-web/ \ No newline at end of file +mumble-web/ +*.log \ No newline at end of file diff --git a/build_mumble_web.sh b/build_mumble_web.sh index f59d5bd..9b91787 100755 --- a/build_mumble_web.sh +++ b/build_mumble_web.sh @@ -12,6 +12,11 @@ DIST_DIR="/home/node/dist" # path on the host where to copy the files DESTINATION_HOST="./dist" +function verify_commit_HEAD() { + cd $REPOSITORY + git verify-commit -v HEAD + cd ../ +} # check if git repository is already cloned # then pull updates @@ -19,20 +24,21 @@ DESTINATION_HOST="./dist" if cd $REPOSITORY then git pull - git verify-commit -v HEAD cd ../ else git clone $URL_GITHUB - cd $REPOSITORY - git verify-commit -v HEAD - cd ../ fi +# print verify-commit output +verify_commit_HEAD # build docker image -docker build -t $IMAGE_NAME . +printf "\nBuilding image\n" +docker build -t $IMAGE_NAME . > build.log # create temporary container docker create --name $CONTAINER_NAME "${IMAGE_NAME}" +# remove previously copied files +rm -rf dist/ # copy files from container to host docker cp $CONTAINER_NAME:"${DIST_DIR}" $DESTINATION_HOST # remove created container -- GitLab