diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d6d0425 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM ubuntu:18.04 + +RUN apt-get update && apt-get install -y curl gnupg bash squid + +# zerotier +RUN curl -s https://install.zerotier.com | bash + +# ZeroTier relies on UDP port 9993 +EXPOSE 9993/udp + +RUN mkdir -p /var/lib/zerotier-one + +COPY ./main.sh /main.sh +RUN chmod 0755 /main.sh + +ENTRYPOINT ["/main.sh"] + diff --git a/main.sh b/main.sh new file mode 100644 index 0000000..6bd78dd --- /dev/null +++ b/main.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# start zerotier service +zerotier-one -d + +# start squid +squid + +while sleep 60; do + ps aux | grep zerotier |grep -q -v grep + PROCESS_1_STATUS=$? + ps aux |grep squid |grep -q -v grep + PROCESS_2_STATUS=$? + # If the greps above find anything, they exit with 0 status + # If they are not both 0, then something is wrong + if [ $PROCESS_1_STATUS -ne 0 -o $PROCESS_2_STATUS -ne 0 ]; then + echo "One of the processes has already exited." + exit 1 + fi +done +