aboutsummaryrefslogtreecommitdiffstats
path: root/docker/rebuild_osmocom_jenkins_image.sh
blob: 5d14d8343fff77baee31186a91261a2e085f49c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash -e

# Executes docker build with the given parameters and retry in case of error.
function build_once() {
	# shellcheck disable=SC2068
	docker build $@ -f Dockerfile_osmocom_jenkins.amd64 .
}

# Builds a container with a debian version and tag name as parameter.
function build_container() {
	local tag_name=${1}
	local debian_version=${2}

	echo "Pulling ${debian_version} image"
	docker pull "debian:${debian_version}"

	echo "Building for ${debian_version} and setting tag ${tag_name}"
	build_once "-t" "${tag_name}" "--build-arg" DEBIAN_VERSION="${debian_version}"
}

# Create containers using stretch (Debian 9.0) as base.
build_container osmocom:deb9_amd64 stretch