zeus
3 years ago
3 changed files with 166 additions and 88 deletions
@ -0,0 +1,160 @@ |
|||
#!/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 |
|||
|
|||
|
|||
|
|||
# EDIT step 1 |
|||
|
|||
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 |
|||
|
|||
# EDIT step 2 |
|||
|
|||
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 |
|||
|
|||
# EDIT step 3 |
|||
|
|||
cat << EOF > $SRPATH/files.tmp |
|||
/bin/cp -rf $SRPATH/cls $Wdir |
|||
/bin/cp -rf $SRPATH/latex-all $Wdir/latex-all |
|||
EOF |
|||
|
|||
# EDIT step 4 |
|||
|
|||
# ############################### |
|||
# EDIT-BEGIN |
|||
# |
|||
# Open Ports you can use |
|||
# {R_PORT1} - {R_PORT5} |
|||
# |
|||
# ############################### |
|||
|
|||
cat << EOF > $SRPATH/docker-compose.tmp |
|||
#ports: |
|||
# - "\${R_PORT1}:80" |
|||
# - "\${R_PORT2}:443" |
|||
networks: |
|||
- ${HYBRID_NETWORK} |
|||
volumes: |
|||
# ############################# |
|||
# you do not need to edit it |
|||
# |
|||
# - $Wdir/project:/home/docker/project |
|||
# - $Wdir/$bootstrap:/usr/bin/$bootstrap |
|||
# ############################# |
|||
- $Wdir/project:/home/docker/project |
|||
- $Wdir/$bootstrap:/usr/bin/$bootstrap |
|||
- $Wdir/latex-all:/usr/local/bin/latex-all |
|||
- $Wdir/docs:/home |
|||
- /tmp/.X11-unix:/tmp/.X11-unix |
|||
|
|||
EOF |
|||
|
|||
|
|||
# EDIT step 5 |
|||
|
|||
cat $SRPATH/sec_bootstrap.1 > $SRPATH/sec_bootstrap |
|||
cat << EOF >> $SRPATH/sec_bootstrap |
|||
# In Dockerfiles, an ENTRYPOINT instruction is used to set executables that will always run when the container is initiated. |
|||
# e.g. |
|||
# |
|||
# xelatex file.tex |
|||
# |
|||
EOF |
|||
cat $SRPATH/sec_bootstrap.2 >> $SRPATH/sec_bootstrap |
|||
|
|||
|
|||
# EDIT step 6 |
|||
echo "edit $SRPATH/setup.sh" |
|||
echo "edit $SRPATH/extrapackages" |
|||
|
|||
|
|||
# EDIT step 7 |
|||
|
|||
echo "edit $SRPATH/ROOT_PASSWORD" |
|||
|
|||
|
|||
# cd in base directory |
|||
# . |
|||
# ├── check-open.sh |
|||
# ├── images |
|||
# │ └── swarmlab-network.png |
|||
# ├── install |
|||
# │ ├── etc |
|||
# │ │ ├── bash_completion.d |
|||
# │ │ │ └── swarmlab-mpi-autocompletion.sh |
|||
# │ │ └── swarmlab-mpi.sh |
|||
# │ └── usr |
|||
# │ └── share |
|||
# │ └── swarmlab.io |
|||
# │ └── sec |
|||
# │ ├── auto_update_hosts |
|||
# ├── LICENSE |
|||
# │ └── swarmlab-index.js |
|||
# └── README.md |
|||
# |
|||
# |
|||
# ######################### RUN ########################### |
|||
# ./install/usr/share/swarmlab.io/sec/swarmlab-gen.sh |
|||
# ./install/usr/share/swarmlab.io/sec/swarmlab-sec create |
|||
# ./install/usr/share/swarmlab.io/sec/swarmlab-sec up |
|||
# ./install/usr/share/swarmlab.io/sec/swarmlab-sec down |
|||
|
|||
# ######################### git push ########################### |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -1,62 +0,0 @@ |
|||
#!/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 |
Loading…
Reference in new issue