|
| 1 | +# ONIE build environment for CI. |
| 2 | +# |
| 3 | +# Debian 11 is required: onie/build-config/Makefile still pulls in |
| 4 | +# python2-era tooling (python-all-dev) that is unavailable on newer |
| 5 | +# Debian releases. |
| 6 | +# |
| 7 | +# This image builds the generic kvm_x86_64 target with secure boot |
| 8 | +# enabled. It includes the secure-boot key-generation and EFI signing |
| 9 | +# tooling (gnupg2, efitools, sbsigntool), the NSS command-line tools the |
| 10 | +# shim signing step shells out to (libnss3-tools: pk12util/certutil), and |
| 11 | +# the build dependencies for the pesign that ONIE compiles from source |
| 12 | +# (NSS/NSPR dev packages). |
| 13 | +FROM debian:11 |
| 14 | +WORKDIR /onie |
| 15 | + |
| 16 | +# Tolerate transient Debian mirror hiccups (connection resets mid-fetch). |
| 17 | +RUN echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/80-retries |
| 18 | + |
| 19 | +# Build dependencies for crosstool-NG and the ONIE image. |
| 20 | +RUN apt-get update && apt-get install -y \ |
| 21 | + autoconf \ |
| 22 | + autoconf-archive \ |
| 23 | + automake \ |
| 24 | + autopoint \ |
| 25 | + bc \ |
| 26 | + bison \ |
| 27 | + bsdmainutils \ |
| 28 | + build-essential \ |
| 29 | + coreutils \ |
| 30 | + cpio \ |
| 31 | + curl \ |
| 32 | + device-tree-compiler \ |
| 33 | + dosfstools \ |
| 34 | + efitools \ |
| 35 | + fakeroot \ |
| 36 | + flex \ |
| 37 | + gawk \ |
| 38 | + git \ |
| 39 | + gnupg2 \ |
| 40 | + gperf \ |
| 41 | + help2man \ |
| 42 | + libefivar-dev \ |
| 43 | + libelf-dev \ |
| 44 | + libexpat1 \ |
| 45 | + libexpat1-dev \ |
| 46 | + libncurses5 \ |
| 47 | + libncurses5-dev \ |
| 48 | + libnspr4-dev \ |
| 49 | + libnss3-dev \ |
| 50 | + libnss3-tools \ |
| 51 | + libpopt-dev \ |
| 52 | + libssl-dev \ |
| 53 | + libtool \ |
| 54 | + libtool-bin \ |
| 55 | + locales \ |
| 56 | + mtools \ |
| 57 | + pkgconf \ |
| 58 | + python-all-dev \ |
| 59 | + python3-all-dev \ |
| 60 | + python3-sphinx \ |
| 61 | + python3-venv \ |
| 62 | + rst2pdf \ |
| 63 | + rsync \ |
| 64 | + sbsigntool \ |
| 65 | + stgit \ |
| 66 | + texinfo \ |
| 67 | + tree \ |
| 68 | + u-boot-tools \ |
| 69 | + unzip \ |
| 70 | + util-linux \ |
| 71 | + uuid-dev \ |
| 72 | + uuid-runtime \ |
| 73 | + wget \ |
| 74 | + zip \ |
| 75 | + xorriso \ |
| 76 | + && rm -rf /var/lib/apt/lists/* |
| 77 | + |
| 78 | +# Generate UTF-8 locale (needed for the uclibc / crosstool-NG build). |
| 79 | +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ |
| 80 | + locale-gen |
| 81 | + |
| 82 | +# Create the build user with the same UID/GID as the host invoker so |
| 83 | +# build artifacts are not left owned by root. Override at build time |
| 84 | +# with --build-arg UID=$(id -u) --build-arg GID=$(id -g). |
| 85 | +# |
| 86 | +# NOTE: -l avoids docker layer-export hangs for large UIDs. |
| 87 | +# (https://github.com/moby/moby/issues/5419#issuecomment-41478290) |
| 88 | +ARG UID=1000 |
| 89 | +ARG GID=1000 |
| 90 | +RUN groupadd -g $GID build && \ |
| 91 | + useradd -l -m -u $UID -g $GID -s /bin/bash build && \ |
| 92 | + chown -R build:build /onie |
| 93 | + |
| 94 | +USER build |
| 95 | + |
| 96 | +# /sbin and /usr/sbin hold tools the build invokes. |
| 97 | +RUN echo 'export PATH="/sbin:/usr/sbin:$PATH"' >> ~/.bashrc |
| 98 | + |
| 99 | +# The build runs git commands; give it a default identity. |
| 100 | +RUN git config --global user.email "build@example.com" && \ |
| 101 | + git config --global user.name "Build User" |
| 102 | + |
| 103 | +CMD ["/bin/bash", "--login"] |
0 commit comments