-
Notifications
You must be signed in to change notification settings - Fork 787
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 bud --target functionality missing #632
Comments
Specifying target build stage (--target) When building a Dockerfile with multiple build stages, --target can be used to specify an intermediate build stage by name as a final stage for the resulting image. Commands after the target stage will be skipped.
|
@TomSweeneyRedHat Now since @umohnani8 has added layers, this should be doable? @umohnani8 WDYT? |
from docker build docs.
|
@TomSweeneyRedHat Do we still have this issue? |
@rhatdan I think it's now doable with @umohnani8 's changes for layering, but I don't think we've the code in place in the bud command to accept the --target option yet. |
Hitting this issue hard as I need multistage builds with Any workaround I could use in the meantime? How can I tag an intermediate layer (you may assume I know how many layers down it is)? And I mean programatically; it does work to manually copy the hash from the right point in the build output and tag it, but I really don't wanna have to regex into that. |
podman 1.0 and buildah 1.6 should have support for this. |
@rhatdan I think the code is in place to make this work now, but we don't have the --target option available for use yet. |
Ok, could you make this happen. |
yep, I'll bump it up the todo list. |
Signed-off-by: TomSweeneyRedHat <[email protected]> Add the --target option to the bud command. This allows the user to specify the last stage to build in a multi stage Dockerfile. Addresses containers#632 Tests: ``` FROM fedora:latest RUN touch /foo FROM alpine:latest AS mytarget RUN touch /1 STEP 1: FROM alpine:latest AS mytarget Getting image source signatures Copying blob 6c40cc604d8e: 2.63 MiB / 2.63 MiB [============================] 2s Copying config caf27325b298: 1.48 KiB / 1.48 KiB [==========================] 0s Writing manifest to image destination Storing signatures STEP 2: RUN touch /1 STEP 3: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Copying blob 3266af627e70: 3.50 KiB / 3.50 KiB [============================] 0s Copying config 52c07ff42762: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> 52c07ff42762c07286ecb608c342df4af7105190ce30f70b678ff667a26c1842 STEP 4: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Skipping blob 3266af627e70 (already present): 3.50 KiB / 3.50 KiB [=========] 0s Copying config c75fd71d1f59: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> c75fd71d1f59c500b2009151919b3ee183c0314db9e91f30e348daca6bbaa74b IMAGE NAME IMAGE TAG IMAGE ID CREATED AT SIZE docker.io/library/alpine latest caf27325b298 Jan 30, 2019 17:19 5.8 MB localhost/tom ``` Signed-off-by: TomSweeneyRedHat <[email protected]>
Signed-off-by: TomSweeneyRedHat <[email protected]> Add the --target option to the bud command. This allows the user to specify the last stage to build in a multi stage Dockerfile. Addresses containers#632 Tests: ``` FROM fedora:latest RUN touch /foo FROM alpine:latest AS mytarget RUN touch /1 STEP 1: FROM alpine:latest AS mytarget Getting image source signatures Copying blob 6c40cc604d8e: 2.63 MiB / 2.63 MiB [============================] 2s Copying config caf27325b298: 1.48 KiB / 1.48 KiB [==========================] 0s Writing manifest to image destination Storing signatures STEP 2: RUN touch /1 STEP 3: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Copying blob 3266af627e70: 3.50 KiB / 3.50 KiB [============================] 0s Copying config 52c07ff42762: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> 52c07ff42762c07286ecb608c342df4af7105190ce30f70b678ff667a26c1842 STEP 4: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Skipping blob 3266af627e70 (already present): 3.50 KiB / 3.50 KiB [=========] 0s Copying config c75fd71d1f59: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> c75fd71d1f59c500b2009151919b3ee183c0314db9e91f30e348daca6bbaa74b IMAGE NAME IMAGE TAG IMAGE ID CREATED AT SIZE docker.io/library/alpine latest caf27325b298 Jan 30, 2019 17:19 5.8 MB localhost/tom ``` Signed-off-by: TomSweeneyRedHat <[email protected]>
Signed-off-by: TomSweeneyRedHat <[email protected]> Add the --target option to the bud command. This allows the user to specify the last stage to build in a multi stage Dockerfile. Addresses containers#632 Tests: ``` FROM fedora:latest RUN touch /foo FROM alpine:latest AS mytarget RUN touch /1 STEP 1: FROM alpine:latest AS mytarget Getting image source signatures Copying blob 6c40cc604d8e: 2.63 MiB / 2.63 MiB [============================] 2s Copying config caf27325b298: 1.48 KiB / 1.48 KiB [==========================] 0s Writing manifest to image destination Storing signatures STEP 2: RUN touch /1 STEP 3: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Copying blob 3266af627e70: 3.50 KiB / 3.50 KiB [============================] 0s Copying config 52c07ff42762: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> 52c07ff42762c07286ecb608c342df4af7105190ce30f70b678ff667a26c1842 STEP 4: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Skipping blob 3266af627e70 (already present): 3.50 KiB / 3.50 KiB [=========] 0s Copying config c75fd71d1f59: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> c75fd71d1f59c500b2009151919b3ee183c0314db9e91f30e348daca6bbaa74b IMAGE NAME IMAGE TAG IMAGE ID CREATED AT SIZE docker.io/library/alpine latest caf27325b298 Jan 30, 2019 17:19 5.8 MB localhost/tom ``` Signed-off-by: TomSweeneyRedHat <[email protected]>
Signed-off-by: TomSweeneyRedHat <[email protected]> Add the --target option to the bud command. This allows the user to specify the last stage to build in a multi stage Dockerfile. Addresses containers#632 Tests: ``` FROM fedora:latest RUN touch /foo FROM alpine:latest AS mytarget RUN touch /1 STEP 1: FROM alpine:latest AS mytarget Getting image source signatures Copying blob 6c40cc604d8e: 2.63 MiB / 2.63 MiB [============================] 2s Copying config caf27325b298: 1.48 KiB / 1.48 KiB [==========================] 0s Writing manifest to image destination Storing signatures STEP 2: RUN touch /1 STEP 3: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Copying blob 3266af627e70: 3.50 KiB / 3.50 KiB [============================] 0s Copying config 52c07ff42762: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> 52c07ff42762c07286ecb608c342df4af7105190ce30f70b678ff667a26c1842 STEP 4: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Skipping blob 3266af627e70 (already present): 3.50 KiB / 3.50 KiB [=========] 0s Copying config c75fd71d1f59: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> c75fd71d1f59c500b2009151919b3ee183c0314db9e91f30e348daca6bbaa74b IMAGE NAME IMAGE TAG IMAGE ID CREATED AT SIZE docker.io/library/alpine latest caf27325b298 Jan 30, 2019 17:19 5.8 MB localhost/tom ``` Signed-off-by: TomSweeneyRedHat <[email protected]>
Signed-off-by: TomSweeneyRedHat <[email protected]> Add the --target option to the bud command. This allows the user to specify the last stage to build in a multi stage Dockerfile. Addresses containers#632 Tests: ``` cat ./bud/target/Dockerfile FROM ubuntu:latest RUN touch /1 FROM alpine:latest AS mytarget RUN touch /2 FROM busybox:latest AS mytarget2 RUN touch /3 buildah bud --debug=false -t tom --target mytarget ./bud/target . STEP 1: FROM ubuntu:latest STEP 2: RUN touch /1 STEP 3: FROM alpine:latest AS mytarget STEP 4: RUN touch /2 STEP 5: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Copying blob 66e5f29a7649: 3.50 KiB / 3.50 KiB [============================] 0s Copying config e72f1fa3d72d: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> e72f1fa3d72ddd3f23acb22a059ecce33dad571433223389e3ce92a5fd9ebae5 STEP 6: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Skipping blob 66e5f29a7649 (already present): 3.50 KiB / 3.50 KiB [=========] 0s Copying config e72620d8efe7: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> e72620d8efe764178d1352dfb3a9a773794309ee9e879e17d3803b18553f5025 buildah images IMAGE NAME IMAGE TAG IMAGE ID CREATED AT SIZE docker.io/library/ubuntu latest 20bb25d32758 Jan 22, 2019 17:41 90 MB docker.io/library/alpine latest caf27325b298 Jan 30, 2019 17:19 5.8 MB localhost/tom latest 993ee7ded616 Feb 5, 2019 13:49 5.8 MB ``` Signed-off-by: TomSweeneyRedHat <[email protected]>
Signed-off-by: TomSweeneyRedHat <[email protected]> Add the --target option to the bud command. This allows the user to specify the last stage to build in a multi stage Dockerfile. Addresses containers#632 Tests: ``` cat ./bud/target/Dockerfile FROM ubuntu:latest RUN touch /1 FROM alpine:latest AS mytarget RUN touch /2 FROM busybox:latest AS mytarget2 RUN touch /3 buildah bud --debug=false -t tom --target mytarget ./bud/target . STEP 1: FROM ubuntu:latest STEP 2: RUN touch /1 STEP 3: FROM alpine:latest AS mytarget STEP 4: RUN touch /2 STEP 5: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Copying blob 66e5f29a7649: 3.50 KiB / 3.50 KiB [============================] 0s Copying config e72f1fa3d72d: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> e72f1fa3d72ddd3f23acb22a059ecce33dad571433223389e3ce92a5fd9ebae5 STEP 6: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Skipping blob 66e5f29a7649 (already present): 3.50 KiB / 3.50 KiB [=========] 0s Copying config e72620d8efe7: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> e72620d8efe764178d1352dfb3a9a773794309ee9e879e17d3803b18553f5025 buildah images IMAGE NAME IMAGE TAG IMAGE ID CREATED AT SIZE docker.io/library/ubuntu latest 20bb25d32758 Jan 22, 2019 17:41 90 MB docker.io/library/alpine latest caf27325b298 Jan 30, 2019 17:19 5.8 MB localhost/tom latest 993ee7ded616 Feb 5, 2019 13:49 5.8 MB ``` Signed-off-by: TomSweeneyRedHat <[email protected]>
Signed-off-by: TomSweeneyRedHat <[email protected]> Add the --target option to the bud command. This allows the user to specify the last stage to build in a multi stage Dockerfile. Addresses #632 Tests: ``` cat ./bud/target/Dockerfile FROM ubuntu:latest RUN touch /1 FROM alpine:latest AS mytarget RUN touch /2 FROM busybox:latest AS mytarget2 RUN touch /3 buildah bud --debug=false -t tom --target mytarget ./bud/target . STEP 1: FROM ubuntu:latest STEP 2: RUN touch /1 STEP 3: FROM alpine:latest AS mytarget STEP 4: RUN touch /2 STEP 5: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Copying blob 66e5f29a7649: 3.50 KiB / 3.50 KiB [============================] 0s Copying config e72f1fa3d72d: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> e72f1fa3d72ddd3f23acb22a059ecce33dad571433223389e3ce92a5fd9ebae5 STEP 6: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage]localhost/tom:latest Getting image source signatures Skipping blob 503e53e365f3 (already present): 5.52 MiB / 5.52 MiB [=========] 0s Skipping blob 66e5f29a7649 (already present): 3.50 KiB / 3.50 KiB [=========] 0s Copying config e72620d8efe7: 704 B / 704 B [================================] 0s Writing manifest to image destination Storing signatures --> e72620d8efe764178d1352dfb3a9a773794309ee9e879e17d3803b18553f5025 buildah images IMAGE NAME IMAGE TAG IMAGE ID CREATED AT SIZE docker.io/library/ubuntu latest 20bb25d32758 Jan 22, 2019 17:41 90 MB docker.io/library/alpine latest caf27325b298 Jan 30, 2019 17:19 5.8 MB localhost/tom latest 993ee7ded616 Feb 5, 2019 13:49 5.8 MB ``` Signed-off-by: TomSweeneyRedHat <[email protected]> Closes: #1321 Approved by: vrothberg
This issue can probably be closed now? It seems to have made it to 1.7 (at least according to the release notes). |
Description
buildah bud --target
is missing and needs to be provided. This is functionality that Docker has.#599 is the parent issue for this issue.
Output of
buildah version
:Buildah v0.16
The text was updated successfully, but these errors were encountered: