FROM ghcr.io/rust-cross/cargo-zigbuild:latest # The base image may resolve its toolchain through $HOME, which the runner does not preserve for # action containers, so pin it to a fixed path. entrypoint.sh re-exports this because the runner # injects the workflow environment into action containers as well. ENV RUSTUP_HOME=/usr/local/rustup RUN if ! rustup default >/dev/null 2>&1; then \ rustup toolchain install stable --profile minimal --no-self-update; \ rustup default stable; \ fi # The image ships the toolchain, zig, a macOS SDK and cargo-zigbuild, but not the bits the build and # packaging scripts need. RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates zip zstd \ && rm -rf /var/lib/apt/lists/* # Install every target up front so building needs no network access. `universal2-apple-darwin` is # not a rustc target: cargo-zigbuild builds both architectures and merges them. RUN rustup target install \ aarch64-unknown-linux-musl \ x86_64-unknown-linux-musl \ x86_64-pc-windows-gnu \ aarch64-apple-darwin \ x86_64-apple-darwin COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]