Skip to content

Migrate build system from Earthly to pure Docker#1

Draft
JWhitleyWork wants to merge 3 commits into
mainfrom
drop-eartlhy
Draft

Migrate build system from Earthly to pure Docker#1
JWhitleyWork wants to merge 3 commits into
mainfrom
drop-eartlhy

Conversation

@JWhitleyWork

Copy link
Copy Markdown
Member

Problem

The Space ROS image build depended on Earthly, which is an extra, non-standard tool to install and maintain (CI downloaded a release binary on every run) and has known issues moving large image layers from its internal registry proxy into the local Docker daemon (the --disable-remote-registry-proxy workaround in the old usage docs). This migrates the build to plain Docker so the only required tooling is Docker with Buildx (already present in current installs).

Approach

A single multi-stage Dockerfile reproduces every Earthly stage. Mapping:

  • COPY +stage/artifactCOPY --from=stage (WORKDIR is /spaceros_ws).
  • dev vs. main variant: selected with --build-arg IMAGE_VARIANT={main,dev} + a shell if in the build and image stages. An unrecognized variant is now a hard error instead of silently building the release path.
  • IKOS conditional copy: COPY --from cannot expand build args, so a FROM ikos-${IMAGE_VARIANT} selector stage resolves to the populated IKOS install for dev and an empty directory for main. IKOS is added to PATH at runtime by entrypoint.sh (gated on /opt/ikos/bin existing) so the bare-bones main image keeps a clean environment.
  • SAVE ARTIFACT … AS LOCAL → two FROM scratch export stages (export-repos, export-build-test) consumed via docker buildx … --output type=local.

A Makefile wraps the docker buildx invocations (main-image, dev-image, all, build-test, generate-repos) as drop-in replacements for the old earthly +target commands.

CI (earthly-build.yamldocker-build.yaml) switches to docker buildx with docker/setup-buildx-action, using --load so the existing docker tag/docker push steps still find the image in the local daemon. All GHCR/DockerHub push conditionals, image labels, the build-test archive upload, and triggers are preserved unchanged.

WORKSPACE_DIR is pinned to a fixed ENV (not an overridable build-arg) so the absolute paths the export stages copy from stay consistent.

Commits

  1. Add the Docker build (Dockerfile, Makefile, .dockerignore, entrypoint.sh).
  2. Replace the Earthly CI workflow with Docker Buildx.
  3. Remove the Earthfile and update docs.

Notes / follow-ups

  • Build cache: Earthly auto-cached layers across runs; the buildx jobs currently start cold. Adding cache-from/cache-to: type=gha would restore parity but the dev build's cache likely exceeds GHA's 10 GB limit, so it was left out pending a real CI run to tune.
  • The full image build was not run locally (the dev environment cannot reach the rosdistro index at raw.githubusercontent.com); docker buildx build --check passes for all targets and the pre-installation/setup stages execute up to that network call. A real CI run is the end-to-end validation.

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.

1 participant