-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-release
executable file
·61 lines (50 loc) · 1.45 KB
/
build-release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
path=$PWD
tag=latest
version=4.5.7
distro=alpine
distro_tag=3.14.2
if [ ! -z "$1" ];
then
tag=$1
fi
if [ ! -z "$2" ];
then
version=$2
fi
if [ ! -z "$3" ];
then
distro=$3
fi
if [ ! -z "$4" ];
then
distro_tag=$4
fi
if [ -f "$PWD/.as/docker-registry" ];
then
docker_registry=`cat $PWD/.as/docker-registry`
source_tarball_release_uri=https://downloads.powerdns.com/releases/
source_tarball_name=pdns-recursor-${version}.tar.bz2
source_tarball_url=${source_tarball_release_uri}${source_tarball_name}
if [ ! -f "$PWD/src/pdns-recursor-${version}.tar.bz2" ];
then
echo "Source tarball not found for version $version at $PWD/src/${source_tarball_name}. Downloading from $source_tarball_url"
curl -o $PWD/src/$source_tarball_name $source_tarball_url
else
echo "Source tarball found for version $version at $PWD/src/${source_tarball_name}."
fi
if [ -f "$PWD/Dockerfile-$distro-$distro_tag" ];
then
docker_file=Dockerfile-$distro-$distro_tag
elif [ -f "$PWD/Dockerfile-$distro" ];
then
docker_file=Dockerfile-$distro
else
docker_file=Dockerfile
fi
docker build --force-rm -f $PWD/$docker_file -t $docker_registry:$tag --build-arg AS_PDNS_VERSION=$version --build-arg DISTRO=$distro --build-arg DISTRO_TAG=$distro_tag $path
else
echo "Could not find a Docker registry URL file at $PWD/.as/docker-registry"
exit 1
fi
exit