sbx-kits/grain-toolchainpublic Fork
⑂ main
Commits
⬇ Clone ▾
git clone https://git.rickub.com/sbx-kits/grain-toolchain.git
git clone ssh://git@rickub.com/sbx-kits/grain-toolchain.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
🛟 Updated. bb06360 · on main · k33g · 4h ago
grain-toolchain.dockerfile · 46 lines · 1.6 KBGDScript3 Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# syntax=docker/dockerfile:1

# --- build stage: download the prebuilt Grain binary ------------------------
# Runs on the build platform: it only downloads the target-arch binary, so
# multi-arch builds need no emulation.
FROM --platform=$BUILDPLATFORM debian:trixie-slim AS build
ARG GRAIN_VERSION
ARG TARGETARCH
ARG BUILDARCH

# A heredoc RUN does not stop at the first failing line by itself: every
# script starts with `set -eu`.
RUN <<EOF
set -eu
apt-get update
# libstdc++6: only needed to run the version check below.
apt-get install -y --no-install-recommends curl ca-certificates libstdc++6
rm -rf /var/lib/apt/lists/*
EOF

# Release assets are named grain-linux-{x64,arm64}.tar.gz (arm64 since 0.7.3).
RUN <<EOF
set -eu
case "${TARGETARCH}" in
  amd64) arch=x64 ;;
  arm64) arch=arm64 ;;
  *) echo "unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;;
esac
mkdir -p /out/usr/local/bin
curl -fsSL "https://github.com/grain-lang/grain/releases/download/grain-v${GRAIN_VERSION}/grain-linux-${arch}.tar.gz" \
  | tar -xz -C /out/usr/local/bin grain
chmod 0755 /out/usr/local/bin/grain
# The tarball keeps the CI runner uid: hand the tree to root.
chown -R 0:0 /out
# Every pin is a claim about content: fail on a version mismatch.
# (Skipped when cross-building.)
if [ "${TARGETARCH}" = "${BUILDARCH}" ]; then
  /out/usr/local/bin/grain --version | grep -qx "${GRAIN_VERSION}"
fi
EOF

# --- overlay: only the grain binary lands on the workload -------------------
# The binary is dynamically linked against glibc + libstdc++, both present on
# the Debian-based agent workloads.
FROM scratch
COPY --from=build /out/ /