#!/bin/bash SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink TARGET="$(readlink "$SOURCE")" if [[ $TARGET == /* ]]; then SOURCE="$TARGET" else DIR="$( dirname "$SOURCE" )" SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located fi done SRPATH="$( dirname "$SOURCE" )" SFPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )" if [ "$SFPATH" != "$SRPATH" ]; then RDIR=$SRPATH # relativ path directory fi cwdir=$PWD cat << EOF > $SRPATH/swarmlab-template-image IMAGE_local="microservice-xelatexthesis" IMAGE_origin="hub.swarmlab.io:5480/xelatex-basegui" GIT_origin="https://git.swarmlab.io:3000/swarmlab/swarmlab-microservice-example.git" service_GUI=true service_WEB=true service_URL=http EOF cat << EOF > $SRPATH/Dockerfile.tmp RUN export DEBIAN_FRONTEND=noninteractive \ && rm -rf /usr/share/doc \ && rm -rf /usr/share/man \ && rm -rf /usr/share/locale \ && mkdir -p /var/run/sshd \ && addgroup -S docker && adduser -S docker -G docker \ && echo 'root:$ROOT_PASSWORD' | chpasswd \ && echo "export VISIBLE=now" >> /etc/profile \ && mkdir -p /home/docker/project \ && mkdir -p /etc/opt \ && echo "docker:docker" | chpasswd \ && echo "StrictHostKeyChecking no" > \${SSHDIR}/config \ && cat \${SSHDIR}/*.pub >> \${SSHDIR}/authorized_keys \ && chmod -R 600 \${SSHDIR}/* \ && chown -R \${USER1}:\${USER1} \${SSHDIR} COPY .vimrc /home/docker RUN /setup.sh EXPOSE 8080 EOF