qemu/tests/docker/dockerfiles/debian-toolchain.docker
Alex Bennée 93bd2954f4 tests/docker: add USER stanzas to non-lci images
These are flat but not generated by lcitool so we need to manually
update them with the `useradd` stanza.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230228190653.1602033-20-alex.bennee@linaro.org>
2023-03-01 12:45:11 +00:00

42 lines
1.3 KiB
Docker

#
# 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