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

build: fixes multi-platform docker build #116

Merged
merged 1 commit into from
Jan 17, 2025
Merged

Conversation

nacx
Copy link
Contributor

@nacx nacx commented Jan 17, 2025

Fixes the multi-platform Docker build (see as an example this build only building for the current arch/platform). The main issue was that inside the docker target, the PLATFORMS and GOARCH_LIST variables were set as shell variables (at target execution time), but they were expected to be Makefile variables (target definition time) by the docker target.

This PR fixes it by properly defining the values as target-scoped variables, to avoid them interfering in other targets).

Before:

$  make docker-build.extproc ENABLE_MULTI_PLATFORMS=true TAG=$TAG DOCKER_BUILD_ARGS="--push"
-> Building extproc for linux/amd64
<- Built out/extproc-linux-amd64
make[1]: Leaving directory '/home/runner/work/ai-gateway/ai-gateway'
docker buildx build . -t ghcr.io/envoyproxy/ai-gateway/extproc:latest --build-arg COMMAND_NAME=extproc  --push

After:

$ make docker-build.extproc ENABLE_MULTI_PLATFORMS=true TAG=$TAG DOCKER_BUILD_ARGS="--push"
-> Building extproc for linux/amd64
<- Built out/extproc-linux-amd64
-> Building extproc for linux/arm64
<- Built out/extproc-linux-arm64
make[1]: Leaving directory '/home/runner/work/ai-gateway/ai-gateway'
docker buildx build . -t ghcr.io/envoyproxy/ai-gateway/extproc:latest --build-arg COMMAND_NAME=extproc --platform linux/amd64,linux/arm64 --push

Signed-off-by: Ignasi Barrera <[email protected]>
@nacx nacx requested a review from a team as a code owner January 17, 2025 11:13
Copy link
Member

@mathetake mathetake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

@mathetake mathetake changed the title fix multi-platform docker build build: fixes multi-platform docker build Jan 17, 2025
@mathetake mathetake merged commit 1b4cc18 into envoyproxy:main Jan 17, 2025
8 of 9 checks passed
@nacx nacx deleted the makefile branch January 18, 2025 19:09
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.

2 participants