binpot is the repository holding Dockerfiles and Github workflows to statically build binaries for all CPU architectures supported by Docker.
TL;DR ⏩ Usage:
FROMalpine:3.14COPY --from=qmcgaw/binpot:helm /bin /usr/local/bin/helm Programs available
Search programs on Docker Hub
All Docker images and programs are built for every CPU architecture supported by Docker
Initial situation 🤔 I developed VSCode development containers Dockerfiles for amd64 only, which covers most machines....
Alpine is tiny. The alpine:3.14 Docker image is only 5.6MB uncompressed on amd64.
Alpine achieves this partly thanks to busybox, which Docker image busybox is only 1.24MB.
Alpine comes with wget implemented in its Busybox multi-call binary.
You can try it with:
docker run -it --rm busybox wget But why isn’t curl implemented as well, or instead of wget?? 🤔
wget vs curl The following table shows some key differences between the two, comparing the two installs on Alpine by using...
buildkit is now included with Docker Desktop and the Docker buildx plugin.
We can now build an image for multiple CPU architectures by using the flag --platform in the docker buildx build command. For example docker buildx build --platform=linux/amd64,linux/arm64 ..
You can however keep on using the native build platform by using the --platform=${BUILDPLATFORM} flag in your Dockerfile’s FROM instruction.
For example:
FROM--platform=${BUILDPLATFORM} golang:1.16-alpine3.13 AS builderYou will usually specify the TARGETPLATFORM argument further down in the Docker build stage block....
Please read Buildkit cross architecture building bug instead, this page is actually wrong.
Building cross CPU Docker images for Go programs is not a trivial task.
With the excellent Go compiler and the recent improvements of Docker building, quite an advanced setup can be achieved to build Docker images for all CPU architectures supported by Docker and Go.
What we’ll do We will design a Dockerfile cross building a simple Go program for Docker images supporting multiple CPU architectures.
The aim is to have the statically compiled Go program in a final Docker image based on the alpine:3....
We will design a continous integration (CI) using Github Actions to automatically build a simple Alpine based Docker image for every CPU architecture supported by Docker.
The final image will only print the machine type for this experiment using uname -m.
Make sure to check out the Conclusion which highlights more posts about Docker image cross compilation with programming languages such as Go.
Prerequisites Have a Github account Have a Github repository Repository setup Have this minimal file structure in your repository:...