-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
leonzdev
committed
Mar 8, 2020
0 parents
commit 1cd3309
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|