diff --git a/build_mumble_web.sh b/build_mumble_web.sh new file mode 100755 index 0000000000000000000000000000000000000000..b36da29d5fd158b6644e92ed9ac56332e796fd5e --- /dev/null +++ b/build_mumble_web.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Mumble-Web repository +REPOSITORY="mumble-web" +URL_GITHUB="https://github.com/Johni0702/${REPOSITORY}.git" +# name of the image which will be build +IMAGE_NAME="build_mumble_web_image" +# name of the temporarily created container +CONTAINER_NAME="build_mumble_web_container" +# path to the directorie "dist" in the image +DIST_DIR="/home/node/dist" +# path on the host where to copy the files +DESTINATION_HOST="./dist" + + +# check if git repository is already cloned +# then pull updates +# if not clone repository +if cd $REPOSITORY +then + git pull + cd ../ +else + git clone $URL_GITHUB +fi + +# build docker image +docker build -t $IMAGE_NAME . +# create temporary container +docker create --name $CONTAINER_NAME "${IMAGE_NAME}" +# copy files from container to host +docker cp $CONTAINER_NAME:"${DIST_DIR}" $DESTINATION_HOST +# remove created container +docker rm -f $CONTAINER_NAME +# remove the created image +# otherwise it would only pull updates +# from other node dependenices +# if there was an update in the repository +docker rmi $IMAGE_NAME \ No newline at end of file