aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--docker/Dockerfile_osmocom_jenkins.amd643
-rwxr-xr-xdocker/rebuild_osmocom_jenkins_image.sh28
2 files changed, 26 insertions, 5 deletions
diff --git a/docker/Dockerfile_osmocom_jenkins.amd64 b/docker/Dockerfile_osmocom_jenkins.amd64
index 48536ac..25a9f61 100644
--- a/docker/Dockerfile_osmocom_jenkins.amd64
+++ b/docker/Dockerfile_osmocom_jenkins.amd64
@@ -1,4 +1,5 @@
-FROM debian:jessie
+ARG DEBIAN_VERSION=jessie
+FROM debian:${DEBIAN_VERSION}
RUN \
echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list && \
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