docker: rebuild: if building fails, try a --no-cache build

Building a docker image depending on a debian upstream has the problem that an
intermediate build result will depend on an APT package archive that is
probable to become outdated. It's necessary to do an 'apt-get update' regularly
to get the newest package archives and be able to install new packages. We
never know which 'apt-get install' steps we might be editing, so we'd have to
add an 'apt-get update' before each, or use an ADD line to find out whether the
package archive has changed, before each and every apt-get install step. We're
likely to miss those in the future, and it would be a large, complex change.

Instead, try to build the docker image with --no-cache in case a cached build
has failed. This should fetch the most recent debian upstream with a proper
archive.

Fixes the current problem that the rebuild_osmocom_jenkins_image.sh is stuck on
various build slaves, should trigger a --no-cache build on each slave.

Change-Id: I37110287dabd53d3537d94ecd74cf513396971b3
This commit is contained in:
Your Name 2018-01-15 14:09:17 +01:00 committed by Neels Hofmeyr
parent 1ad873d4d5
commit 3eca350f60
1 changed files with 3 additions and 1 deletions

View File

@ -1,2 +1,4 @@
#!/bin/sh
docker build -t osmocom:amd64 - < Dockerfile_osmocom_jenkins.amd64
# 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 .