From 50a14079f4c4509e7c15379ab15058ea4cdc5772 Mon Sep 17 00:00:00 2001
From: Armin <armin.co@gmx.de>
Date: Mon, 8 Jun 2020 14:43:12 +0200
Subject: [PATCH] Added script.

Script to build mumble web.
---
 build_mumble_web.sh | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100755 build_mumble_web.sh

diff --git a/build_mumble_web.sh b/build_mumble_web.sh
new file mode 100755
index 0000000..b36da29
--- /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
-- 
GitLab