Rust SDK.
Install Docker and configure BuildKit:
docker buildx create --use --name buildkit
Use as builder:
docker run --rm -it quay.io/bitski/rust-sdk:latest
Use as cross-compiler in a Dockerfile
:
# syntax=docker/dockerfile:1
#############################################################################
# Build container #
#############################################################################
# Use the native builder image
FROM --platform=$BUILDPLATFORM quay.io/bitski/rust-sdk AS builder
# Expose build env variables
ARG TARGETARCH
# Expose GitHub Actions cache args
ARG ACTIONS_CACHE_URL
ARG ACTIONS_RUNNER_DEBUG
ARG ACTIONS_RUNTIME_TOKEN
ARG GITHUB_SHA
ARG SCCACHE_GHA_CACHE_MODE
# Build and install the binary
RUN --mount=target=. \
--mount=type=cache,target=/var/cache/cargo/git \
--mount=type=cache,target=/var/cache/cargo/target,sharing=private \
cargo install --locked --root /usr/local
#############################################################################
# Release container #
#############################################################################
# Use the target release image
FROM registry.access.redhat.com/ubi8/ubi-minimal AS release
# Copy the built binaries
COPY --from=builder /usr/local/bin/* /usr/local/bin/
# Set the image command
CMD ["/usr/local/bin/hello-world"]
If you run into any issues, see cross-rs/cross
for possible missing
environmental variables.
Build a local image:
docker buildx bake --load local
Login to GitHub and Quay.io:
docker login ghcr.io
docker login quay.io
If you are not using Docker Desktop, install QEMU binaries:
docker run --rm --privileged tonistiigi/binfmt:latest --install arm64
Then build and publish the multi-platform image:
docker buildx bake --push