22/53
Sign inSign up free

834. Cross-Compile Instead of Emulating

medium 20 XP ~9 minHands-on lab

Labs have no container engine, so nothing is built: your files are checked by reading them.

CI builds scheduler-ui for two platforms with docker buildx build --platform linux/amd64,linux/arm64 .. The arm64 half takes 40 minutes: BuildKit runs the whole build stage, compiler included, under QEMU emulation.

Task

Change /home/student/projects/scheduler-ui/Dockerfile so that:

  • the build stage always runs on the platform of the machine doing the build (use the automatic build argument for it),
  • it compiles for the target platform: declare the automatic TARGETOS and TARGETARCH arguments in that stage and pass them to go build as GOOS and GOARCH (keep CGO_ENABLED=0),
  • the final stage still uses the target platform (no --platform there).

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.