1#
2# Docker cross-compiler target
3#
4# This docker target uses prebuilt toolchains for LoongArch64 from:
5# https://github.com/loongson/build-tools/releases
6#
7FROM docker.io/library/debian:11-slim
8
9# Duplicate deb line as deb-src
10RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
11
12RUN apt-get update && \
13    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
14    DEBIAN_FRONTEND=noninteractive eatmydata \
15    apt-get install -y --no-install-recommends \
16        build-essential \
17        ca-certificates \
18        curl \
19        gettext \
20        git \
21        python3-minimal
22
23RUN curl -#SL https://github.com/loongson/build-tools/releases/download/2022.05.29/loongarch64-clfs-5.0-cross-tools-gcc-glibc.tar.xz \
24    | tar -xJC /opt
25
26ENV PATH $PATH:/opt/cross-tools/bin
27ENV LD_LIBRARY_PATH /opt/cross-tools/lib:/opt/cross-tools/loongarch64-unknown-linux-gnu/lib:$LD_LIBRARY_PATH
28# As a final step configure the user (if env is defined)
29ARG USER
30ARG UID
31RUN if [ "${USER}" ]; then \
32  id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
33