|
| 1 | +FROM ubuntu:latest |
| 2 | + |
| 3 | +# This docker file allows for testing the build_gcc.yml actions workload locally. |
| 4 | +# args: |
| 5 | +# * GCC_VERSION: version of gcc to use. ct-ng only supports building the latest minor revision of the specific major revision. |
| 6 | +# the supported values will differ between different commits of ct-ng. |
| 7 | +# * LIBC: build a glibc or musl based toolchain |
| 8 | +# * LIBC_VERSION: version of the specified libc to use. based on the supported versions ct-ng enables building. |
| 9 | +# * REBUILD_ID: used to differentiate newer builds of an already supported toolchain for toolchains_cc releases. |
| 10 | +# * GITHUB_TOKEN: the token used to upload artifacts to the release. will skip the upload if not provided |
| 11 | + |
| 12 | +# ================= |
| 13 | +# || Create User || |
| 14 | +# ================= |
| 15 | +# ct-ng cant build as root; it needs to run as a user. |
| 16 | +# as well, github actions need sudo to install ct-ng after building and to do apt install |
| 17 | +RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y sudo gh |
| 18 | + |
| 19 | +RUN useradd -m -s /bin/bash builder && \ |
| 20 | + usermod -aG sudo builder |
| 21 | +RUN echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
| 22 | +USER builder |
| 23 | +WORKDIR /home/builder |
| 24 | + |
| 25 | +# ======================= |
| 26 | +# || Environment Setup || |
| 27 | +# ======================= |
| 28 | +ENV CT_NG_SRC_DIR="/tmp/crosstool-ng" |
| 29 | +ENV ARTIFACT_DIR="/tmp/toolchain/artifacts" |
| 30 | +ENV OUTPUT_DIR="/tmp/toolchain/output" |
| 31 | +ENV WORK_DIR="/tmp/toolchain/work" |
| 32 | +ENV SCRIPTS_DIR="/tmp/scripts" |
| 33 | + |
| 34 | +RUN mkdir -p $CT_NG_SRC_DIR |
| 35 | +RUN mkdir -p $ARTIFACT_DIR |
| 36 | +RUN mkdir -p $OUTPUT_DIR |
| 37 | +RUN mkdir -p $WORK_DIR |
| 38 | +RUN mkdir -p $SCRIPTS_DIR |
| 39 | + |
| 40 | +ARG GCC_VERSION=15 |
| 41 | +ARG LIBC=gnu |
| 42 | +ARG LIBC_VERSION=2.34 |
| 43 | +ARG REBUILD_ID=1 |
| 44 | + |
| 45 | +# ===================== |
| 46 | +# || Build Toolchain || |
| 47 | +# ===================== |
| 48 | +COPY step-1_install_dependencies $SCRIPTS_DIR/step-1_install_dependencies |
| 49 | +RUN $SCRIPTS_DIR/step-1_install_dependencies |
| 50 | + |
| 51 | +COPY step-2_build_crosstool_ng $SCRIPTS_DIR/step-2_build_crosstool_ng |
| 52 | +RUN $SCRIPTS_DIR/step-2_build_crosstool_ng |
| 53 | + |
| 54 | +COPY step-3_configure_toolchain $SCRIPTS_DIR/step-3_configure_toolchain |
| 55 | +RUN $SCRIPTS_DIR/step-3_configure_toolchain |
| 56 | + |
| 57 | +COPY step-4_build_toolchain $SCRIPTS_DIR/step-4_build_toolchain |
| 58 | +RUN $SCRIPTS_DIR/step-4_build_toolchain |
| 59 | + |
| 60 | +COPY step-5_package_toolchain $SCRIPTS_DIR/step-5_package_toolchain |
| 61 | +RUN $SCRIPTS_DIR/step-5_package_toolchain |
| 62 | + |
| 63 | +ARG GITHUB_TOKEN |
| 64 | +COPY step-6_upload_release $SCRIPTS_DIR/step-6_upload_release |
| 65 | +RUN $SCRIPTS_DIR/step-6_upload_release |
0 commit comments