aboutsummaryrefslogtreecommitdiffstats
path: root/docker/rebuild_osmocom_jenkins_image.sh
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2019-02-19 03:41:25 +0000
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2019-02-19 05:06:38 +0000
commitf8a085347a8b573e616183286fbaa9bea0a90ccb (patch)
tree333f69b08a0c556969e964580d3655ce2fd9b745 /docker/rebuild_osmocom_jenkins_image.sh
parenta6d9db32c1507f4ce89f24fb15a94f197928a82e (diff)
docker: Use the same Dockerfile for jessie and stretch
The binaries built on the Jenkins to be used by the osmo-gsm-tester require libgnutls.so.30. This is provided by the libgnutls30 package which is not available on jessie (Debian 8) and a backport requires some effort. Re-use the existing Dockerfile for jessie and stretch (Debian 9) using an argument. Refactor the shell script to pass the right argument. Add the debian version into the tag name to make space for buster (Debian 10). Change-Id: I44c8e49a548cb64defd2eba868ec4bd435de90ba
Diffstat (limited to 'docker/rebuild_osmocom_jenkins_image.sh')
-rwxr-xr-xdocker/rebuild_osmocom_jenkins_image.sh28
1 files changed, 24 insertions, 4 deletions
diff --git a/docker/rebuild_osmocom_jenkins_image.sh b/docker/rebuild_osmocom_jenkins_image.sh
index b49292a..3dcca39 100755
--- a/docker/rebuild_osmocom_jenkins_image.sh
+++ b/docker/rebuild_osmocom_jenkins_image.sh
@@ -1,4 +1,24 @@
-#!/bin/sh
-# In case the debian apt archive has become out of sync, try a --no-cache build if it fails.
-docker build -t osmocom:amd64 -f Dockerfile_osmocom_jenkins.amd64 . \
- || docker build --no-cache -t osmocom:amd64 -f Dockerfile_osmocom_jenkins.amd64 .
+#!/bin/bash
+
+# Executes docker build with the given parameters and retry in case of error.
+function build_once() {
+ # In case the debian apt archive has become out of sync, try a
+ # --no-cache build if it fails.
+
+ # shellcheck disable=SC2068
+ docker build $@ -f Dockerfile_osmocom_jenkins.amd64 . \
+ || docker build --no-cache $@ -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 "Building for ${debian_version} and setting tag ${tag_name}"
+ build_once "-t" "${tag_name}" "--build-arg" DEBIAN_VERSION="${debian_version}"
+}
+
+# Create containers using jessie (Debian 8.0) and stretch (Debian 9.0) as base.
+build_container osmocom:amd64 jessie
+build_container osmocom:deb9_amd64 stretch