xref: /qemu/tests/docker/dockerfiles/debian-toolchain.docker (revision f2b901098e14ad1aaffab82464917b8679499cc5)
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 #
7 FROM 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 
13 RUN 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 
28 ADD build-toolchain.sh /root/build-toolchain.sh
29 
30 RUN 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 image,
34 # then copying the built toolchain from stage 0.
35 FROM docker.io/library/debian:11-slim
36 COPY --from=0 /usr/local /usr/local
37 # As a final step configure the user (if env is defined)
38 ARG USER
39 ARG UID
40 RUN if [ "${USER}" ]; then \
41   id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
42