aboutsummaryrefslogtreecommitdiff
path: root/tests/docker/dockerfiles/debian-toolchain.docker
blob: 687a97fec4a965e52a9cd774929ce1f34b51ece4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
# 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.
#
FROM docker.io/library/debian:11-slim

# 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 \
        ca-certificates \
        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,
# and the build trees by restoring the original image,
# then copying the built toolchain from stage 0.
FROM docker.io/library/debian:11-slim
COPY --from=0 /usr/local /usr/local
# 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