Skip to content

Commit

Permalink
Makes /vpn regular dir in container
Browse files Browse the repository at this point in the history
  • Loading branch information
gynnantonix committed Sep 15, 2020
1 parent 6cc8092 commit 20332f7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ RUN apk --no-cache --no-progress upgrade && \
rm -rf /tmp/*

COPY openvpn.sh /usr/bin/
COPY configs /vpn

HEALTHCHECK --interval=60s --timeout=15s --start-period=120s \
CMD curl -LSs 'https://api.ipify.org'

VOLUME ["/vpn"]

ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/openvpn.sh"]
ENTRYPOINT ["/sbin/tini", "--", "/vpn/start.sh"]
17 changes: 17 additions & 0 deletions configs/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

## put whatever is necessary to acquire / build .ovpn files into /vpn here

echo $0

[[ -L vpn.conf ]] && rm vpn.conf

if [[ ! -e vpn.conf ]]; then
selected=$(find . -name '*.ovpn' | shuf | head -1)
if [[ ! -r $selected ]]; then
echo "Unable to read configuration file ($selected)"
exit 1
fi
echo "Selected $selected as configuration file"
ln -s $selected vpn.conf
fi
9 changes: 9 additions & 0 deletions configs/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

echo $0

cd /vpn
if [[ -x ./configure.sh ]]; then
./configure.sh || exit 1
fi
exec /usr/bin/openvpn.sh

0 comments on commit 20332f7

Please sign in to comment.