File tree Expand file tree Collapse file tree 3 files changed +22
-5
lines changed
Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 1010 OUTPUT_DIR : /tmp/toolchain/output
1111 WORK_DIR : /tmp/toolchain/work
1212 BUILD_GCC_SH : ./infra/gcc/build_gcc.sh
13- SUDO : " sudo"
1413
1514 GCC_VERSION : 15
1615 LIBC : gnu
Original file line number Diff line number Diff line change 11FROM ubuntu:latest
22
3+ # =================
4+ # || Create User ||
5+ # =================
6+ # ct-ng cant build as root; it needs to run as a user.
7+ # as well, github actions need sudo to install ct-ng after building and to do apt install
8+ RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y sudo
9+
10+ RUN useradd -m -s /bin/bash builder && \
11+ usermod -aG sudo builder
12+ RUN echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
13+ USER builder
14+ WORKDIR /home/builder
15+
16+ # =======================
17+ # || Environment Setup ||
18+ # =======================
319ENV CT_NG_SRC_DIR="/tmp/crosstool-ng"
420ENV ARTIFACT_DIR="/tmp/toolchain/artifacts"
521ENV OUTPUT_DIR="/tmp/toolchain/output"
622ENV WORK_DIR="/tmp/toolchain/work"
723ENV BUILD_GCC_SH="/tmp/build_gcc.sh"
8- ENV SUDO=""
924
1025RUN mkdir -p $CT_NG_SRC_DIR
1126RUN mkdir -p $ARTIFACT_DIR
@@ -19,6 +34,9 @@ ARG LIBC=gnu
1934ARG LIBC_VERSION=2.34
2035ARG REBUILD_ID=1
2136
37+ # =====================
38+ # || Build Toolchain ||
39+ # =====================
2240RUN $BUILD_GCC_SH install_dependencies
2341RUN $BUILD_GCC_SH build_crosstool_ng
2442RUN $BUILD_GCC_SH configure_toolchain
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ ensure_environment_variables() {
1313}
1414
1515install_dependencies () {
16- $SUDO apt update
17- DEBIAN_FRONTEND=noninteractive $SUDO apt install -y \
16+ sudo apt update
17+ DEBIAN_FRONTEND=noninteractive sudo apt install -y \
1818 build-essential \
1919 autoconf \
2020 flex \
@@ -41,7 +41,7 @@ build_crosstool_ng() {
4141 ./bootstrap
4242 ./configure
4343 make
44- make install
44+ sudo make install
4545 popd
4646}
4747
You can’t perform that action at this time.
0 commit comments