-
Notifications
You must be signed in to change notification settings - Fork 760
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
Extend --from
flag with support for multi-stage builds in buildah build
#5401
Comments
Could you show an original Containerfile and what you would expect to be changed via the --from or --from-target command? |
I have following file: FROM ubuntu:latest as Downloader
RUN apt-get update && apt-get install -y curl
# Download and install Go
RUN curl -L https://go.dev/dl/go1.20.6.linux-amd64.tar.gz --output /tmp/go1.20.6.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf /tmp/go1.20.6.linux-amd64.tar.gz \
&& rm /tmp/go1.20.6.linux-amd64.tar.gz
# Change the base image
FROM centos:latest as NewBase
COPY --from=Downloader /usr/local/go /usr/local/go
# Set environment variables to add Go to the PATH
ENV PATH="$PATH:/usr/local/go/bin" I want to change I have more complex base images and I want to make use of multi-stage builds and cache to speed up image building. |
A friendly reminder that this issue had no activity for 30 days. |
I still need this(ability to change FROM instruction other than first FROM statement) (My usecase is specific to very last FROM instruction). |
A friendly reminder that this issue had no activity for 30 days. |
/kind feature
Description
When using
buildah build --from
for Containerfile having multi-stage builds, it is not sufficient for modifying FROM instructions of later build stages in the file.This issue requests support for changing FROM instructions in Containerfile having multiple build stages.
The same has been previously mentioned here #4821 (comment)
This is the exact requirement that I want to achieve.
I propose to extend the existing
--from
flag while keeping it backwards compatible with the following syntax:--from "target=image,target2=image"
Here
--from
takes a comma separated list. If the target is omitted then that means first FROM instruction.Examples:
--from builder=ubuntu:22.04,final=alpine:latest
# changes FROM instructions of builder stage with "ubuntu:22.04" and final stage with "alpine:latest"--from nginx:latest
# changes first FROM instructionAnother alternative to comma-separated list is to use
--from
multiple times.The text was updated successfully, but these errors were encountered: