1#
2# Docker toolchain cross-compiler
3#
4# This dockerfile is used for building a cross-compiler toolchain.
5# The script for building the toolchain is supplied via extra-files.
6#
7FROM docker.io/library/debian:11-slim
8
9# Install build utilities for building gcc and glibc.
10# ??? The build-dep isn't working, missing a number of
11# minimal build dependiencies, e.g. libmpc.
12
13RUN apt update && \
14    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
15    DEBIAN_FRONTEND=noninteractive eatmydata \
16    apt install -y --no-install-recommends \
17        bison \
18        ca-certificates \
19        flex \
20        gawk \
21        libmpc-dev \
22        libmpfr-dev \
23        rsync \
24        wget && \
25    DEBIAN_FRONTEND=noninteractive eatmydata \
26    apt build-dep -yy --arch-only gcc glibc
27
28ADD build-toolchain.sh /root/build-toolchain.sh
29
30RUN cd /root && ./build-toolchain.sh
31
32# Throw away the extra toolchain build deps, the downloaded source,
33# and the build trees by restoring the original debian10 image,
34# then copying the built toolchain from stage 0.
35FROM docker.io/library/debian:bullseye-slim
36COPY --from=0 /usr/local /usr/local
37