10000 fix: enhance Dockerfile for multi-platform builds by thiagoalmeidasa · Pull Request #300 · angelnu/gateway-admision-controller · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: enhance Dockerfile for multi-platform builds #300

10000 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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thiagoalmeidasa
Copy link

Description of the change

This PR improves the support for building multiple platforms Dockerfile.

  • Removed explicit platform from base image, using ${BUILDPLATFORM} instead.
  • Added TARGETPLATFORM, BUILDPLATFORM, TARGETOS, and TARGETARCH arguments for clarity and flexibility.
  • Ensures consistent platform handling throughout the build process.

Benefits

Multi arch builds are working again.

Possible drawbacks

Applicable issues

Additional information

Running from my raspberry pi:

$ docker container run -ti --rm  gateway-admision-controller
Loaded image: gateway-admision-controller:latest
{"addr":":8080","app":"gateway-admision-controller","http-server":"webhooks","level":"info","lib":"kubewebhook","msg":"Command config is config.CmdConfig{Debug:false, Development:false, SetGatewayDefault:false, WebhookListenAddr:\":8080\", MetricsListenAddr:\"\", MetricsPath:\"\", TLSCertFilePath:\"\", TLSKeyFilePath:\"\", Gateway:\"\", D
NS:\"\", DNSPolicy:\"\", SetGatewayLabel:\"\", SetGatewayLabelValue:\"\", SetGatewayAnnotation:\"\", SetGatewayAnnotationValue:\"\", InitImage:\"\", InitImagePullPol:\"\", InitCmd:\"\", InitMountPoint:\"\", SidecarImage:\"\", SidecarImagePullPol:\"\", SidecarCmd:\"\", SidecarMountPoint:\"\", SidecarAsInit:false, ConfigmapName:\"\"}","serv
ice":"webhook-handler","time":"2025-05-07T15:11:32Z","version":"dev","webhook":"gatewayPodMutator"}
{"addr":":8080","app":"gateway-admision-controller","http-server":"webhooks","level":"info","lib":"kubewebhook","msg":"Current DNS config is resolv.Resolver{Domains:[]string{}, Nameservers:[]string{\"192.168.100.1\"}, Search:[]string{\"lan\"}, Sortlist:[]string{}, Options:[]resolv.ResolverOption{}}","service":"webhook-handler","time":"202
5-05-07T15:11:32Z","version":"dev","webhook":"gatewayPodMutator"}
{"addr":":8080","app":"gateway-admision-controller","http-server":"webhooks","level":"warning","msg":"webhook running without TLS","time":"2025-05-07T15:11:32Z","version":"dev"}
{"addr":":8080","app":"gateway-admision-controller","http-server":"webhooks","level":"info","msg":"http server listening...","time":"2025-05-07T15:11:32Z","version":"dev"}
^C{"app":"gateway-admision-controller","level":"info","msg":"signal interrupt received","time":"2025-05-07T15:11:33Z","version":"dev"}
{"addr":":8080","app":"gateway-admision-controller","http-server":"webhooks","level":"info","msg":"start draining connections","time":"2025-05-07T15:11:33Z","version":"dev"}
{"addr":":8080","app":"gateway-admision-controller","http-server":"webhooks","level":"info","msg":"server stopped","time":"2025-05-07T15:11:33Z","version":"dev"}

This commit improves the support building for multiple platforms Dockerfile.

- Removed explicit platform from base image, using `${BUILDPLATFORM}` instead.
- Added `TARGETPLATFORM`, `BUILDPLATFORM`, `TARGETOS`, and `TARGETARCH` arguments for clarity and flexibility.
- Ensures consistent platform handling throughout the build process.

Fixes: angelnu#299
@angelnu
Copy link
Owner
angelnu commented May 7, 2025

Thanks for the pr. Merging so we can test the ci.

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.

Multiarch is not working on container image 3.11 and 3.12
2 participants
0