master
docker 50 lines 1.57 KB
Raw
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:13-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 # Add deb-src repository sources
14 RUN sed -i "s/^Types: deb$/Types: deb deb-src/" \
15 /etc/apt/sources.list.d/debian.sources
16
17 RUN apt update && \
18 DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
19 DEBIAN_FRONTEND=noninteractive eatmydata \
20 apt install -y --no-install-recommends \
21 bison \
22 ca-certificates \
23 flex \
24 gawk \
25 libmpc-dev \
26 libmpfr-dev \
27 rsync \
28 wget && \
29 DEBIAN_FRONTEND=noninteractive eatmydata \
30 apt build-dep -yy --arch-only gcc glibc
31
32 ADD build-toolchain.sh /root/build-toolchain.sh
33
34 RUN cd /root && ./build-toolchain.sh
35
36 # Throw away the extra toolchain build deps, the downloaded source,
37 # and the build trees by restoring the original image,
38 # then copying the built toolchain from stage 0.
39 FROM docker.io/library/debian:13-slim
40 RUN apt update && \
41 DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
42 DEBIAN_FRONTEND=noninteractive eatmydata \
43 apt install -y --no-install-recommends \
44 libmpc3
45 COPY --from=0 /usr/local /usr/local
46 # As a final step configure the user (if env is defined)
47 ARG USER
48 ARG UID
49 RUN if [ "${USER}" ]; then \
50 id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi