Menu

Setting Up Docker CI for Rust with cargo-dist
📰
0

Setting Up Docker CI for Rust with cargo-dist

DEV Community·Wayne·about 1 month ago
#xZYM9t8m
#rust#docker#ci#fullscreen#linux#dist
Reading 0:00
15s threshold

Rust CI The Core Idea Building Rust inside Docker is slow. A typical multi-stage Dockerfile compiles the binary in one stage and copies it into a minimal image in another. That works fine for local builds, but in CI it takes a long time, especially when you're emulating arm64 through QEMU. The better approach: let cargo-dist handle the compilation as part of the release workflow. By the time the Docker job runs, the binaries are already built and available as GitHub Actions artifacts. Docker just copies them in. QEMU is still needed for the final multi-arch manifest, but it's only moving files around rather than running a compiler through emulation, so arm64 builds don't take nearly as long. The Setup The starting point is the cargo-dist quickstart guide . Once that's in place, you need a few configuration pieces to trigger the Docker build after the release. In release.yml , add a custom-docker-publish job that calls your docker-publish workflow and passes the plan output and binary name as inputs.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More