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

Add platform option for image building #40944

Closed
scottfrederick opened this issue May 29, 2024 · 5 comments
Closed

Add platform option for image building #40944

scottfrederick opened this issue May 29, 2024 · 5 comments
Assignees
Labels
theme: containers Testcontainers, Docker Compose and Buildpack features type: enhancement A general enhancement
Milestone

Comments

@scottfrederick
Copy link
Contributor

See buildpacks/pack#2154 for the equivalent pack option. The value of a platform option should be passed to the lifecycle API as provided by the user.

@scottfrederick scottfrederick added the type: enhancement A general enhancement label May 29, 2024
@scottfrederick scottfrederick added this to the 3.4.x milestone May 29, 2024
@philwebb philwebb added the theme: containers Testcontainers, Docker Compose and Buildpack features label Jun 17, 2024
@scottfrederick scottfrederick self-assigned this Jul 12, 2024
@StefanLobbenmeierObjego
Copy link

StefanLobbenmeierObjego commented Jul 22, 2024

Current workaround is running pack manually, in my case something like this:

pack build  --platform linux/amd64 \
            --builder paketobuildpacks/builder-jammy-base:latest \
            --buildpack paketo-buildpacks/java \
            --env BP_JVM_VERSION=21 \
            putyourimagenamehere

And if you want to run the gradle build outside of docker make sure to pass the executable .jar file:

jar_path=$(build/libs -maxdepth 1 -name "*.jar" -not -name "*plain.jar" -print -quit)
pack build  --platform linux/amd64 \
            --builder paketobuildpacks/builder-jammy-base:latest \
            --buildpack paketo-buildpacks/java \
            --path $jar_path \
            --env BP_JVM_VERSION=21 \
            putyourimagenamehere

@scottfrederick
Copy link
Contributor Author

While many phases of the CNB lifecycle API do have a -platform option, that option is not related to the --platform option added to the pack CLI. Instead of passing the value of this new option to the lifecycle API, we should pass the value to the Docker Engine API when pulling images and creating containers from images.

To reduce the potential for confusion, we should call the new options in the Maven and Gradle configuration imagePlatform instead of just platform.

@ChildrenGreens
Copy link

@scottfrederick Well done! Looking forward to the official release of version 3.4.0!

@filipblondeel
Copy link

@scottfrederick Does this support specifying multiple platforms, for example linux/amd64 and linux/arm64?

@scottfrederick
Copy link
Contributor Author

scottfrederick commented Nov 20, 2024

@filipblondeel Only one platform option can be specified. Supporting multiple platform options would require Spring Boot to iterate over the entire image-building process for each option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: containers Testcontainers, Docker Compose and Buildpack features type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants