|
|
@ -39,7 +39,7 @@ APTPARAM=" --no-install-recommends " |
|
|
|
IMAGE_local="hybrid-nodevuejs" |
|
|
|
HYBRID_NETWORK="hybrid-nodevuejs" |
|
|
|
# dont edit |
|
|
|
IMAGE_origin="hub.swarmlab.io:5443/hybrid-nodevuejs:latest" |
|
|
|
IMAGE_origin="hub.swarmlab.io:5480/hybrid-nodevuejs:latest" |
|
|
|
bootstrap="sec_bootstrap" |
|
|
|
hostnames="auto_update_hosts" |
|
|
|
hostnames_get="get_hosts" |
|
|
@ -105,11 +105,9 @@ if [ -d "$Wdir/project" ]; then |
|
|
|
# |
|
|
|
# ---------------------------------------------- |
|
|
|
|
|
|
|
rm -f $Wdir/out.log 2> /dev/null |
|
|
|
search='ok' |
|
|
|
|
|
|
|
error="Error:"; |
|
|
|
IMAGE=$(docker inspect --type=image $REGISTRY_ADDR:$REGISTRY_PORT/$IMAGE_NAME:latest 2>&1 | tee $Wdir/out.log) |
|
|
|
if search=$(grep "$error" $Wdir/out.log) |
|
|
|
if [ $search == 'ok' ] |
|
|
|
then |
|
|
|
echo "" |
|
|
|
echo ">>> Load Origin " |
|
|
@ -148,38 +146,6 @@ if [ -d "$Wdir/project" ]; then |
|
|
|
COPY .vimrc /home/docker |
|
|
|
USER docker |
|
|
|
EOF |
|
|
|
else |
|
|
|
echo ">>> Load Local " |
|
|
|
cat << EOF > $Wdir/Dockerfile |
|
|
|
FROM localhost:5000/$IMAGE_local |
|
|
|
# |
|
|
|
USER root |
|
|
|
COPY $bootstrap /usr/bin |
|
|
|
COPY $hostnames_get /usr/bin |
|
|
|
COPY $hostnames /usr/bin |
|
|
|
COPY install-vim-plugin.sh . |
|
|
|
ENV NOTVISIBLE "in users profile" |
|
|
|
ENV USER1 docker |
|
|
|
|
|
|
|
ENV USER_HOME /home/docker |
|
|
|
ENV SSHDIR \${USER_HOME}/.ssh |
|
|
|
COPY ssh/ \${SSHDIR}/ |
|
|
|
|
|
|
|
RUN mkdir -p /var/run/sshd \ |
|
|
|
&& echo 'root:$ROOT_PASSWORD' | chpasswd \ |
|
|
|
&& echo "export VISIBLE=now" >> /etc/profile \ |
|
|
|
&& mkdir -p /etc/opt \ |
|
|
|
&& mkdir -p /home/docker/project \ |
|
|
|
&& echo "docker:docker" | chpasswd \ |
|
|
|
&& echo "StrictHostKeyChecking no" > \${SSHDIR}/config \ |
|
|
|
&& cat \${SSHDIR}/*.pub >> \${SSHDIR}/authorized_keys \ |
|
|
|
&& chmod -R 600 \${SSHDIR}/* \ |
|
|
|
&& chown -R \${USER1}:\${USER1} \${SSHDIR} |
|
|
|
|
|
|
|
WORKDIR /home/docker/project |
|
|
|
COPY .vimrc /home/docker |
|
|
|
USER docker |
|
|
|
EOF |
|
|
|
fi |
|
|
|
else |
|
|
|
echo "" |
|
|
@ -312,10 +278,10 @@ cat << EOF > $Wdir/docker-compose.yml |
|
|
|
version: "2" |
|
|
|
|
|
|
|
services: |
|
|
|
registry: |
|
|
|
image: registry |
|
|
|
ports: |
|
|
|
- "${REGISTRY_PORT}:5000" |
|
|
|
# registry: |
|
|
|
# image: registry |
|
|
|
# ports: |
|
|
|
# - "${REGISTRY_PORT}:5000" |
|
|
|
|
|
|
|
master: |
|
|
|
image: $REGISTRY_ADDR:$REGISTRY_PORT/$IMAGE_NAME |
|
|
@ -457,8 +423,8 @@ clear_all () |
|
|
|
{ |
|
|
|
$(docker stop $(docker ps -a | grep "_master_" | awk '{print $1}')) || true |
|
|
|
$(docker stop $(docker ps -a | grep "_worker_" | awk '{print $1}')) || true |
|
|
|
$(docker stop $(docker ps -a | grep "_registry_" | awk '{print $1}')) || true |
|
|
|
docker ps -a | grep "_registry_" | awk '{print $1}' | xargs docker container rm || true |
|
|
|
#$(docker stop $(docker ps -a | grep "_registry_" | awk '{print $1}')) || true # remove for microservices |
|
|
|
#docker ps -a | grep "_registry_" | awk '{print $1}' | xargs docker container rm || true # remove for microservices |
|
|
|
docker ps -a | grep "_worker_" | awk '{print $1}' | xargs docker container rm || true |
|
|
|
docker ps -a | grep "_master_" | awk '{print $1}' | xargs docker container rm || true |
|
|
|
} |
|
|
@ -482,7 +448,7 @@ up_registry () |
|
|
|
echo "$ docker-compose up -d registry" |
|
|
|
printf "\\n" |
|
|
|
|
|
|
|
#docker stop swarmlab-registry || true && docker rm swarmlab-registry || true |
|
|
|
#docker stop swarmlab-registry || true && docker rm swarmlab-registry || true # remove for microservices |
|
|
|
docker container prune --force |
|
|
|
docker-compose up --no-recreate -d registry |
|
|
|
} |
|
|
@ -700,9 +666,9 @@ if [ $COMMAND_UP -eq 1 ]; then |
|
|
|
create_dockerfile |
|
|
|
down_all |
|
|
|
clear_all |
|
|
|
up_registry |
|
|
|
#up_registry # remove for microservices |
|
|
|
generate_ssh_keys |
|
|
|
build_and_push_image |
|
|
|
#build_and_push_image # remove for microservices |
|
|
|
up_master |
|
|
|
up_workers |
|
|
|
|
|
|
|