openSUSE / obs-build

OBS build script, can be used with OBS or stand alone
GNU General Public License v2.0
132 stars 183 forks source link

Dockerfile: Multiple FROM (multi-stage build) and ARG confuses osb-build #874

Closed fcrozat closed 1 year ago

fcrozat commented 2 years ago

The following Dockerfile which uses several FROM (used for multistage build) and default arguments (ARG) is breaking dependency computation for OBS: https://build.opensuse.org/package/show/home:fcrozat:BCI/obs-build-fails-docker-arg

#!BuildTag: obs/arg_fail:0.1

ARG BCI_GO=registry.suse.com/bci/golang
ARG GO_VERSION=1.18

FROM registry.suse.com/bci/bci-micro AS mini
FROM ${BCI_GO}:${GO_VERSION} AS base
RUN ls -l /

download on demands blocks on : blocked: waiting for dod resources to appear: container:registry.suse.com/bci/bci-micro:latest container:::latest

mlschroe commented 1 year ago

Seems I misread the dockerfile specification. My impression was that at the end of the build scope the arguments are cleared, but that doesn't seem to be the case. I'll check the docker code to find out the correct way.

mlschroe commented 1 year ago

Now fixed.