Skip to content

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.

@DrummyFloyd
Copy link

any news about this ? =)

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

3 participants