Skip to content

Allow container builds to use pre-built pkgs defined by target #634

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

Merged
merged 15 commits into from
Jun 30, 2025

Conversation

MorrisLaw
Copy link
Contributor

What this PR does / why we need it:
This PR adds functionality that allows a user to pass in a pre-built package via a target and then uses that same package when building the container. Allows for users to separate package builds from container builds.

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #597

@MorrisLaw MorrisLaw requested a review from a team as a code owner May 17, 2025 03:23
@cpuguy83 cpuguy83 added this to the v0.16 milestone May 19, 2025
@MorrisLaw MorrisLaw force-pushed the add-use-existing-pkg-option branch from 305d2e4 to 05e21b9 Compare May 22, 2025 14:50
@DannyBrito
Copy link
Contributor

how would this look like when calling for the build?
something like docker build -f <spec> --target="<path-to-rpm>" .?

@MorrisLaw
Copy link
Contributor Author

how would this look like when calling for the build? something like docker build -f <spec> --target="<path-to-rpm>" .?

Good question. I think something like this would be the workflow:

  1. Build the pkg first:
    docker buildx build --file=spec.yaml --target=rpm --output=type=local,dest=./pkgs .

  2. Build the container using the prebuilt pkg:
    docker buildx build --file=spec.yaml --target=container --build-context=rpm-pkg=./pkgs .

If you look in the test, it's also how I'm including it: withBuildContext. Here are the dalec docs as well: https://azure.github.io/dalec/targets/#named-build-contexts

cc/ @cpuguy83 if I'm incorrect or missing anything

@MorrisLaw MorrisLaw force-pushed the add-use-existing-pkg-option branch 3 times, most recently from 47d2abe to b5fa16d Compare May 23, 2025 19:21
@MorrisLaw MorrisLaw force-pushed the add-use-existing-pkg-option branch from 7e7ec2a to 4843088 Compare June 12, 2025 16:26
@MorrisLaw MorrisLaw force-pushed the add-use-existing-pkg-option branch from 2e5026c to 1e51db2 Compare June 23, 2025 15:20
@MorrisLaw MorrisLaw force-pushed the add-use-existing-pkg-option branch from 1e51db2 to 4cd2724 Compare June 24, 2025 20:06
@MorrisLaw MorrisLaw requested a review from cpuguy83 June 25, 2025 16:43
@MorrisLaw MorrisLaw requested a review from cpuguy83 June 26, 2025 19:26
@MorrisLaw MorrisLaw force-pushed the add-use-existing-pkg-option branch from ad6845e to 45bf94b Compare June 27, 2025 19:59
@MorrisLaw MorrisLaw force-pushed the add-use-existing-pkg-option branch from 45bf94b to d6d2ee3 Compare June 28, 2025 00:25
@MorrisLaw
Copy link
Contributor Author

Should be good now after addressing the timeout issue: #671

@cpuguy83 cpuguy83 merged commit 340f921 into Azure:main Jun 30, 2025
22 checks passed
@MorrisLaw MorrisLaw deleted the add-use-existing-pkg-option branch June 30, 2025 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REQ] Add targets to create a container from dir of packages
4 participants