|
| 1 | + |
| 2 | +# syntax=docker/dockerfile:1.6 |
| 3 | + |
| 4 | +# Debian sid (unstable) base image |
| 5 | +FROM debian:sid |
| 6 | + |
| 7 | +# Avoid interactive prompts during apt operations |
| 8 | +ENV DEBIAN_FRONTEND=noninteractive |
| 9 | + |
| 10 | +# Base tooling for Debian packaging + chroot creation |
| 11 | +# (eatmydata/ccache are nice QoL additions; remove if you prefer) |
| 12 | +RUN apt-get update && apt-get install -y \ |
| 13 | + ca-certificates gnupg \ |
| 14 | + curl git jq tree gh \ |
| 15 | + sbuild schroot debootstrap \ |
| 16 | + git-buildpackage devscripts \ |
| 17 | + build-essential debhelper \ |
| 18 | + abigail-tools \ |
| 19 | + eatmydata ccache \ |
| 20 | + && rm -rf /var/lib/apt/lists/* |
| 21 | + |
| 22 | +# Force sbuild to use the schroot backend. |
| 23 | +# sbuild-createchroot is for schroot-managed chroots; this avoids the "unshare" warning. |
| 24 | +RUN mkdir -p /root/.config/sbuild && \ |
| 25 | + printf '%s\n' \ |
| 26 | + '$chroot_mode = "schroot";' \ |
| 27 | + '$schroot = "schroot";' \ |
| 28 | + > /root/.config/sbuild/config.pl |
| 29 | + |
| 30 | +# Optional list of extra packages to seed into the chroot during creation. |
| 31 | +COPY extra-packages.txt /tmp/extra-packages.txt |
| 32 | + |
| 33 | +# Create a Debian sid sbuild chroot and prepare it for cross-building to arm64. |
| 34 | +RUN set -eux; \ |
| 35 | + EXTRA_PACKAGES="$(tr -s '[:space:]' ',' < /tmp/extra-packages.txt || true)"; \ |
| 36 | + \ |
| 37 | + # Create the chroot from Debian mirrors (NOT Ubuntu) with Debian components. |
| 38 | + sbuild-createchroot \ |
| 39 | + --arch=amd64 \ |
| 40 | + --components=main,contrib,non-free,non-free-firmware \ |
| 41 | + ${EXTRA_PACKAGES:+--include="$EXTRA_PACKAGES"} \ |
| 42 | + sid /srv/chroot/sid http://deb.debian.org/debian; \ |
| 43 | + \ |
| 44 | + # Configure the chroot's apt sources + enable multi-arch + install cross toolchain. |
| 45 | + chroot /srv/chroot/sid /bin/bash -lc '\ |
| 46 | + set -eux; \ |
| 47 | + # Minimal, correct sources for Debian sid. Add contrib/non-free only if needed. |
| 48 | + printf "%s\n" \ |
| 49 | + "deb http://deb.debian.org/debian sid main" \ |
| 50 | + "# deb http://deb.debian.org/debian sid contrib non-free non-free-firmware" \ |
| 51 | + > /etc/apt/sources.list; \ |
| 52 | + \ |
| 53 | + # Enable arm64 multi-arch so sbuild can satisfy Build-Depends for the host arch. |
| 54 | + dpkg --add-architecture arm64; \ |
| 55 | + apt-get update; \ |
| 56 | + apt-get -y upgrade; \ |
| 57 | + \ |
| 58 | + # Cross toolchain for arm64 + a small baseline of arm64 libs. |
| 59 | + # sbuild will install package-specific B-Ds later (often :arm64 automatically). |
| 60 | + apt-get install -y --no-install-recommends \ |
| 61 | + crossbuild-essential-arm64 \ |
| 62 | + pkg-config \ |
| 63 | + libc6:arm64 libc6-dev:arm64 linux-libc-dev:arm64 \ |
| 64 | + libstdc++6:arm64 \ |
| 65 | + lintian:amd64; \ |
| 66 | + \ |
| 67 | + # Keep the chroot lean |
| 68 | + apt-get clean; rm -rf /var/lib/apt/lists/* \ |
| 69 | + ' |
| 70 | + |
| 71 | +# Workspace for mounting sources/outputs (your script already bind-mounts /workspace) |
| 72 | +WORKDIR /workspace |
| 73 | + |
| 74 | +# Default shell |
| 75 | +CMD ["bash"] |
0 commit comments