|
| 1 | +# Copyright 2024 Nokia |
| 2 | +# Licensed under the BSD 3-Clause License. |
| 3 | +# SPDX-License-Identifier: BSD-3-Clause |
| 4 | + |
| 5 | +FROM debian:bookworm-slim |
| 6 | +LABEL maintainer="Nokia" |
| 7 | + |
| 8 | +ARG BUILDROOT_VERSION=2023.02.1 |
| 9 | +ARG PARALLEL_PROCS=4 |
| 10 | +ARG DEVICE_CONFIG |
| 11 | +ARG REBUILD_BUILDROOT=yes |
| 12 | +ARG DOCKER_USER=user |
| 13 | + |
| 14 | +ENV DEBIAN_FRONTEND=noninteractive |
| 15 | +ENV BUILDROOT_VERSION=${BUILDROOT_VERSION} |
| 16 | +ENV PARALLEL_PROCS=${PARALLEL_PROCS} |
| 17 | +ENV DEVICE_CONFIG=${DEVICE_CONFIG} |
| 18 | +ENV PATH="${PATH}:/buildroot/output/host/bin" |
| 19 | + |
| 20 | +COPY --chmod=0755 scripts/nokia_toolchain.sh /usr/bin/nokia_toolchain |
| 21 | +COPY --chmod=0755 config/${DEVICE_CONFIG}.config /etc/buildroot.config |
| 22 | +COPY --chmod=0644 environments/${DEVICE_CONFIG}.env /etc/target.env |
| 23 | + |
| 24 | +RUN apt-get update && \ |
| 25 | + apt-get upgrade -y && \ |
| 26 | + apt-get install -y \ |
| 27 | + bc \ |
| 28 | + ca-certificates \ |
| 29 | + cpio \ |
| 30 | + curl \ |
| 31 | + file \ |
| 32 | + gcc-aarch64-linux-gnu \ |
| 33 | + gcc-arm-linux-gnueabi \ |
| 34 | + git \ |
| 35 | + jq \ |
| 36 | + rsync \ |
| 37 | + xz-utils \ |
| 38 | + wget \ |
| 39 | + unzip \ |
| 40 | + dirmngr \ |
| 41 | + fakeroot \ |
| 42 | + less \ |
| 43 | + pkg-config \ |
| 44 | + pkgconf && \ |
| 45 | + apt-get install --no-install-recommends -y \ |
| 46 | + golang-go \ |
| 47 | + binutils \ |
| 48 | + binutils-x86-64-linux-gnu \ |
| 49 | + cpp \ |
| 50 | + g++ \ |
| 51 | + gcc \ |
| 52 | + golang-go \ |
| 53 | + golang-src \ |
| 54 | + libgcc-12-dev \ |
| 55 | + libstdc++-12-dev \ |
| 56 | + rpcsvc-proto && \ |
| 57 | + apt-get install -y \ |
| 58 | + build-essential \ |
| 59 | + libncurses5-dev && \ |
| 60 | + apt-get -y autoremove && \ |
| 61 | + apt-get clean && \ |
| 62 | + rm -rf /var/lib/apt/lists/* && \ |
| 63 | + mkdir -p /buildroot /app && \ |
| 64 | + addgroup ${DOCKER_USER} && adduser ${DOCKER_USER} --ingroup ${DOCKER_USER} && \ |
| 65 | + echo 'export PATH=${PATH}:/buildroot/output/host/bin' >> /etc/bash.bashrc && \ |
| 66 | + echo "PS1='"'${debian_chroot:+($debian_chroot)}\u@${DEVICE_CONFIG}:\w\$ '"'" >> /etc/bash.bashrc && \ |
| 67 | + echo "source /etc/target.env" >> /etc/bash.bashrc && \ |
| 68 | + chown ${DOCKER_USER}:${DOCKER_USER} /buildroot && \ |
| 69 | + chown ${DOCKER_USER}:${DOCKER_USER} /app |
| 70 | + |
| 71 | +USER $DOCKER_USER |
| 72 | + |
| 73 | +RUN curl https://buildroot.org/downloads/buildroot-${BUILDROOT_VERSION}.tar.xz | \ |
| 74 | + tar -C /buildroot -xvJ --strip-components=1 && \ |
| 75 | + cp /etc/buildroot.config /buildroot/.config && \ |
| 76 | + nokia_toolchain |
| 77 | + |
| 78 | +WORKDIR /buildroot |
| 79 | +ENTRYPOINT ["/bin/bash"] |
| 80 | +CMD ["/usr/bin/nokia_toolchain", "build_app"] |
0 commit comments