Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buildah doesn't skip stages in multi-stage Dockerfile #4187

Closed
lucacome opened this issue Aug 16, 2022 · 3 comments
Closed

Buildah doesn't skip stages in multi-stage Dockerfile #4187

lucacome opened this issue Aug 16, 2022 · 3 comments

Comments

@lucacome
Copy link
Contributor

Description

This is an example of a Dockerfile:

FROM golang as base


FROM base as foo
RUN echo "foo"

FROM base as local
COPY . /go/src/go-test/
RUN go build /go/src/go-test/main.go

Building with podman build --target local . I would expect to just build the stages that are needed for the local stage (and not the foo stage). Maybe I'm misunderstanding how this works, but from #2469 I thought it would behave like Docker, and that it would skip the stages that are not needed for the build.

Steps to reproduce the issue:

  1. Create a multi-stage Dockerfile
  2. Build the Dockerfile with --target parameter

Describe the results you received:

❯ podman build --target local .
[1/3] STEP 1/1: FROM golang AS base
--> 26b88b86d19
[3/3] STEP 1/3: FROM 26b88b86d196c85f18b7a014d9d6a0e449e5d60dbd5a46af56289e711bbc8d37 AS local
[3/3] STEP 2/3: COPY . /go/src/go-test/
--> eb34f827f3d
[3/3] STEP 3/3: RUN go build /go/src/go-test/main.go
[3/3] COMMIT
--> e10acebc5fa
[2/3] STEP 1/2: FROM 26b88b86d196c85f18b7a014d9d6a0e449e5d60dbd5a46af56289e711bbc8d37 AS foo
[2/3] STEP 2/2: RUN echo "foo"
foo
--> fe9ccbf8966
e10acebc5fa6259e505f6cf30ca8b5494bad766e6d12fa18b3caf1b0adaa746a

Describe the results you expected:

❯ podman build --target local .
[1/3] STEP 1/1: FROM golang AS base
--> 26b88b86d19
[3/3] STEP 1/3: FROM 26b88b86d196c85f18b7a014d9d6a0e449e5d60dbd5a46af56289e711bbc8d37 AS local
[3/3] STEP 2/3: COPY . /go/src/go-test/
--> eb34f827f3d
[3/3] STEP 3/3: RUN go build /go/src/go-test/main.go
[3/3] COMMIT
--> e10acebc5fa

Output of podman version if reporting a podman build issue:

❯ podman version
Client:       Podman Engine
Version:      4.2.0
API Version:  4.2.0
Go Version:   go1.18.5
Built:        Wed Aug 10 13:46:05 2022
OS/Arch:      darwin/arm64

Server:       Podman Engine
Version:      4.1.1
API Version:  4.1.1
Go Version:   go1.18.4
Built:        Fri Jul 22 12:06:49 2022
OS/Arch:      linux/arm64

Output of uname -a:

Darwin WC14D5QQWT 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000 arm64
@lucacome
Copy link
Contributor Author

lucacome commented Aug 16, 2022

Well I just realized after posting that it says

....
Server:       Podman Engine
Version:      4.1.1
API Version:  4.1.1
Go Version:   go1.18.4
Built:        Fri Jul 22 12:06:49 2022
OS/Arch:      linux/arm64

so maybe this is the problem? That it's 4.1.1? But I'm not sure why the Server and Client versions are not matching....

@rhatdan
Copy link
Member

rhatdan commented Aug 16, 2022

The Server is based on Fedora CoreOS which only updates every couple of weeks on released version. So it might not be out for a week or so.
Reopen if/when the podman 4.2 version on the server breaks.

@rhatdan rhatdan closed this as completed Aug 16, 2022
@lucacome
Copy link
Contributor Author

lucacome commented Aug 16, 2022

I just wanted to let you know that I confirmed that with version 4.2.0 of the server everything works as expected. Sorry for the noise!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants