2021-10-26 13:22:11 +03:00
|
|
|
#
|
|
|
|
# Docker toolchain cross-compiler
|
|
|
|
#
|
|
|
|
# This dockerfile is used for building a cross-compiler toolchain.
|
|
|
|
# The script for building the toolchain is supplied via extra-files.
|
|
|
|
#
|
2022-09-14 18:59:48 +03:00
|
|
|
FROM docker.io/library/debian:11-slim
|
2021-10-26 13:22:11 +03:00
|
|
|
|
|
|
|
# Install build utilities for building gcc and glibc.
|
|
|
|
# ??? The build-dep isn't working, missing a number of
|
|
|
|
# minimal build dependiencies, e.g. libmpc.
|
|
|
|
|
|
|
|
RUN apt update && \
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
|
|
|
|
DEBIAN_FRONTEND=noninteractive eatmydata \
|
|
|
|
apt install -y --no-install-recommends \
|
|
|
|
bison \
|
2022-09-14 18:59:48 +03:00
|
|
|
ca-certificates \
|
2021-10-26 13:22:11 +03:00
|
|
|
flex \
|
|
|
|
gawk \
|
|
|
|
libmpc-dev \
|
|
|
|
libmpfr-dev \
|
|
|
|
rsync \
|
|
|
|
wget && \
|
|
|
|
DEBIAN_FRONTEND=noninteractive eatmydata \
|
|
|
|
apt build-dep -yy --arch-only gcc glibc
|
|
|
|
|
|
|
|
ADD build-toolchain.sh /root/build-toolchain.sh
|
|
|
|
|
|
|
|
RUN cd /root && ./build-toolchain.sh
|
|
|
|
|
|
|
|
# Throw away the extra toolchain build deps, the downloaded source,
|
2023-02-28 22:06:43 +03:00
|
|
|
# and the build trees by restoring the original image,
|
2021-10-26 13:22:11 +03:00
|
|
|
# then copying the built toolchain from stage 0.
|
2023-02-28 22:06:43 +03:00
|
|
|
FROM docker.io/library/debian:11-slim
|
2021-10-26 13:22:11 +03:00
|
|
|
COPY --from=0 /usr/local /usr/local
|
2023-02-28 22:06:48 +03:00
|
|
|
# As a final step configure the user (if env is defined)
|
|
|
|
ARG USER
|
|
|
|
ARG UID
|
|
|
|
RUN if [ "${USER}" ]; then \
|
|
|
|
id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
|