Skip to content

Commit 49055fd

Browse files
committedSep 5, 2018
more release work
Signed-off-by: Christian Winther <jippignu@gmail.com>
1 parent 1ff2e01 commit 49055fd

File tree

2 files changed

+80
-20
lines changed

2 files changed

+80
-20
lines changed
 

‎docker-install.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,25 @@ if [ "${MONGODB_VERSION}" != "no" ]; then
55
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 42F3E95A2C4F08279C4960ADD68FA50FEA312927
66
fi
77

8-
echo 'deb http://repo.pritunl.com/stable/apt xenial main' > /etc/apt/sources.list.d/pritunl.list
98
echo "deb http://build.openvpn.net/debian/openvpn/stable xenial main" > /etc/apt/sources.list.d/openvpn-aptrepo.list
10-
11-
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
129
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 8E6DA8B4E158C569
1310
apt-get update -q
14-
apt-get install locales
11+
apt-get install -y locales iptables wget
1512
locale-gen en_US en_US.UTF-8
1613
dpkg-reconfigure locales
1714
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
1815
apt-get upgrade -y -q
1916
apt-get dist-upgrade -y -q
20-
apt-get -y install pritunl=${PRITUNL_VERSION} iptables
17+
18+
wget --quiet https://github.com/pritunl/pritunl/releases/download/${PRITUNL_VERSION}/pritunl_${PRITUNL_VERSION}-0ubuntu1.xenial_amd64.deb
19+
dpkg -i pritunl_${PRITUNL_VERSION}-0ubuntu1.xenial_amd64.deb
20+
rm pritunl_${PRITUNL_VERSION}-0ubuntu1.xenial_amd64.deb
2121

2222
if [ "${MONGODB_VERSION}" != "no" ]; then
2323
apt-get -y install mongodb-org=${MONGODB_VERSION};
2424
fi
2525

26+
apt-get purge wget
2627
apt-get clean
2728
apt-get -y -q autoclean
2829
apt-get -y -q autoremove

‎update-pritunl.sh

+74-15
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,88 @@
1-
set -ex
1+
set -e
2+
set -o pipefail
23

3-
# find latest tag from github
4-
tag=$(curl https://api.github.com/repos/pritunl/pritunl/tags | jq -r '.[0].name')
4+
DOCKER_ARGS="--squash"
5+
DEBUG=${DEBUG:0}
6+
7+
if [ "${DEBUG}" != "1" ]; then
8+
DOCKER_ARGS="$DOCKER_ARGS --quiet"
9+
fi
10+
11+
if [ "${DEBUG}" == "1" ]; then
12+
set -x
13+
fi
514

615
# ensure checkout directory exist
716
if [ ! -d "/tmp/docker-pritunl" ]; then
817
git clone https://github.com/jippi/docker-pritunl.git /tmp/docker-pritunl
918
fi
1019

1120
# change work dir
12-
cd /tmp/docker-pritunl/
21+
# cd /tmp/docker-pritunl/
1322

1423
# update repo
15-
git pull
24+
# git pull
25+
26+
# docker tags
27+
docker_tags=$(curl -s https://hub.docker.com/v2/repositories/jippi/pritunl/tags/ | jq -r '.results[].name')
28+
docker_tags=""
29+
30+
function has_tag() {
31+
check=$(echo "${docker_tags}" | grep "^$1$")
32+
if [ "${check}" == "" ]; then
33+
return 1
34+
else
35+
return 0
36+
fi
37+
}
38+
39+
# find latest tag from github
40+
github_tags=$(curl -s https://api.github.com/repos/pritunl/pritunl/tags | jq -r '.[].name')
41+
first=1
42+
for tag in $github_tags; do
43+
echo "[${tag}] Processing"
44+
45+
# build with mongo (default container)
46+
if ! has_tag "${tag}"; then
47+
echo "[${tag}] Building"
48+
docker build $DOCKER_ARGS -t "jippi/pritunl:${tag}-minimal" --build-arg PRITUNL_VERSION="${tag}" .
49+
50+
echo "[${tag}] Pushing"
51+
docker push "jippi/pritunl:${tag}"
52+
53+
if [ $first -eq 1 ]; then
54+
echo "[${tag}] Tagging as latest"
55+
docker tag "jippi/pritunl:${tag}" "jippi/pritunl:latest"
56+
57+
echo "[${tag}] Pushing as latest"
58+
docker push "jippi/pritunl:latest"
59+
fi
60+
61+
echo "[${tag}] Done"
62+
else
63+
echo "[${tag}] Already build"
64+
fi
65+
66+
# build without mongo (special tag)
67+
if ! has_tag "${tag}-minimal"; then
68+
echo "[${tag}-minimal] Building"
69+
docker build $DOCKER_ARGS -t "jippi/pritunl:${tag}" --build-arg PRITUNL_VERSION="${tag}" --build-arg MONGODB_VERSION=no .
70+
71+
echo "[${tag}-minimal] Pushing"
72+
docker push "jippi/pritunl:${tag}-minimal"
1673

17-
# build without mongo (default container)
18-
docker build -t "jippi/pritunl:${tag}" --build-arg PRITUNL_VERSION="${tag}*" --build-arg MONGODB_VERSION=no .
19-
docker push "jippi/pritunl:${tag}"
74+
if [ $first -eq 1 ]; then
75+
echo "[${tag}-minimal] Tagging as latest-minimal"
76+
docker tag "jippi/pritunl:${tag}-minimal" "jippi/pritunl:latest-minimal"
2077

21-
docker tag "jippi/pritunl:${tag}" "jippi/pritunl:latest"
22-
docker push "jippi/pritunl:latest"
78+
echo "[${tag}-minimal] Pushing as latest-minimal"
79+
docker push "jippi/pritunl:latest-minimal"
80+
fi
2381

24-
# build with mongo (special tag)
25-
docker build -t "jippi/pritunl:${tag}-mongo" --build-arg PRITUNL_VERSION="${tag}*" .
26-
docker push "jippi/pritunl:${tag}-mongo"
82+
echo "[${tag}-minimal] Done"
83+
else
84+
echo "[${tag}-minimal] Already build"
85+
fi
2786

28-
docker tag "jippi/pritunl:${tag}" "jippi/pritunl:latest-mongo"
29-
docker push "jippi/pritunl:latest-mongo"
87+
first=0
88+
done

0 commit comments

Comments
 (0)