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        texinfo \
25        wget && \
26    DEBIAN_FRONTEND=noninteractive eatmydata \
27    apt build-dep -yy --arch-only gcc glibc
28
29ADD build-toolchain.sh /root/build-toolchain.sh
30
31RUN cd /root && ./build-toolchain.sh
32
33# Throw away the extra toolchain build deps, the downloaded source,
34# and the build trees by restoring the original debian10 image,
35# then copying the built toolchain from stage 0.
36FROM docker.io/library/debian:bullseye-slim
37COPY --from=0 /usr/local /usr/local
38