Log #4 - Iximuiz & stratum project requirement
iximuiz lab and thinking how to approach startum project
14.11.2026
Iximuiz - Use Docker Build Arguments to Inject Version and Commit Metadata into a Go Binary
Well at first i used this pattern:
ARG APP_VERSION=dev
ENV APP_VERSION=$APP_VERSION
ARG COMMIT_HASH=abc1234
ENV COMMIT_HASH=$COMMIT_HASH
Which it didn’t got acccept and from hint found out it this arg needs to be passe while we are using docker build command.
So Dockerfile will look like this:
FROM golang:1.27 AS build
WORKDIR /app
ARG APP_VERSION=dev
ARG COMMIT_HASH=unknown
COPY . .
RUN CGO_ENABLED=0 go build -ldflags "-X main.version=${APP_VERSION} -X main.commitHash=${COMMIT_HASH}" -o server .
FROM alpine:3
COPY --from=build /app/server /app/server
ENV PORT=8080
ENV LOG_FORMAT=json
CMD ["/app/server"]
And build command like this:
docker build \
--build-arg APP_VERSION=1.2.0 \
--build-arg COMMIT_HASH=abc1234 \
-t myapp:v1.2.0 .
Nice.
Iximuiz - Build a Container Image for Another Platform Using QEMU Emulation
Well this is new to me. Never done that. Let’s figure this out.
- Have qemu installed and enabled on your machine link
- Optional: see now you can build in that target platform using
docker buildx ls - Build for the target platform using
docker buildx build --platform linux/arm64 -t <tag> .
That’s it.
But there are other strategies to build for other platform as well though, check the docs.
Iximuiz - Build a Container Image for Another Platform Using Cross-Compilation
This challenge is about the second strategy of buiding application for other platform but this time we are using golang it’s own native feature aka cross compilation.
Base on this docker docs you can solve it.
Iximuiz - Build a Container Image for Another Platform Using a Remote Builder
Really impress by this challenge b/c it would be on the previous 2 challenges. Instead of using QEMU or cross-compilation which have a significant impact on peformance we are going to use different machine to build our software.
Best challenge of the day by far really Really really good.
Here is the workflow:
- Connect the docker to a remote build node and use
--driver docker-containerSth like this:
docker buildx create \
--name remote \
--driver docker-container \
--bootstrap \
ssh://laborant@builder-01
What’s that --driver docker-container?
The driver decides how the builder runs. The engine that actually does Docker builds is called BuildKit.
And what about --bootstrap?
It means start the builder now. Without it, buildx create only saves the settings. Nothing actually starts until your first docker build.
After that if you run docker buildx ls you will see a result like this:
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
remote docker-container
\_ remote0 \_ ssh://laborant@builder-01 running v0.34.2 linux/amd64 (+3), linux/arm64, linux/386
default* docker
\_ default \_ default running v0.34.0 linux/amd64 (+3)
You can change the default to remote using docker buildx use remote which we don’t need it in here.
Then on the current machine you can say i want to build my software on this remote machine and push it to registry and also load the image on my current machine as well.
docker build \
--builder remote \
--platform linux/arm64 \
--push \
--load \
-t registry.iximiuz.com/app:v1.0.0 .
And that’s it.
The coolest i leanred from solution after this was the fact that if you delete the image on current machine you are in dev-01 you can again pull it.
docker pull --platform linux/arm64 \
registry.iximiuz.com/app:v1.0.0
Which it will take it from registry, NICE
What if i turn this challenge into a youtube video? I actually do enjoy this and it does serve the purpose of just putting myself out there more? 🤔