Jenkinsfile: Workaround failure with multistage Dockerfile
The Jenkins Docker workflow plugin fails badly when trying to inspect
the built images when using a multi-stage Dockerfile
.
That's because the plugins naively looks for the image name by taking
all the contents after FROM
, which means it breaks whether a stage
name is introduced with AS stagename
or even if more than a single
space is used after FROM
.
See https://issues.jenkins-ci.org/browse/JENKINS-44609
Invoking docker
directly as suggested on the JIRA issue works around
the problem.
Test run: https://jenkins.apertis.org/job/playground/job/em/job/apertis-lavaphabbridge-image/1/console
Edited by Emanuele Aina