Skip to contentSkip to conversation

Dockerfile: Switch to non-root user

PATCH New Tom Rini 1 participant 4 messages Oct 4, 2019 – Oct 8, 2019

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 Dockerfile: Switch to non-root user

Add a 'uboot' user / group, allow them sudo access and make use of them in the container.

---
 Dockerfile | 5 +++++
 1 file changed, 5 insertions(+)
Dockerfile +5 -0
index 1d7a3dae39d0..c7b35026a171 100644
@@ -136,6 +136,11 @@ RUN git clone git://git.qemu.org/qemu.git /tmp/qemu && \
 	make -j$(nproc) all install && \
 	rm -rf /tmp/qemu
 
+# Create our user/group
+RUN echo uboot ALL=NOPASSWD: ALL > /etc/sudoers.d/uboot
+RUN useradd -m -U uboot
+USER uboot:uboot
+
 # Create the buildman config file
 RUN /bin/echo -e "[toolchain]\nroot = /usr" > ~/.buildman
 RUN /bin/echo -e "kernelorg = /opt/gcc-7.3.0-nolibc/*" >> ~/.buildman
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 Dockerfile: Switch to non-root user

Quoted 4 lines · Tom Rini

Add a 'uboot' user / group, allow them sudo access and make use of them in the container.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191008/5f91955a/attachment.sig>
author
#2 lore raw

PATCH 2/2 Dockerfile: Update to current bionic tag

In reply to Tom Rini

As part of this we stop installing python-pytest (we enforce a specific version via pip in tests) as well as python-coverage (this can and should be done via pip as well).

---
 Dockerfile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
Dockerfile +7 -5
index c7b35026a171..bf840a5f1b33 100644
@@ -2,7 +2,7 @@
 # This Dockerfile is used to build an image containing basic stuff to be used
 # to build U-Boot and run our test suites.
 
-FROM ubuntu:xenial-20190720
+FROM ubuntu:bionic-20190912.1
 MAINTAINER Tom Rini <[email protected]>
 LABEL Description=" This image is for building U-Boot inside a container"
 
@@ -10,9 +10,9 @@ LABEL Description=" This image is for building U-Boot inside a container"
 ENV DEBIAN_FRONTEND=noninteractive
 
 # Add LLVM repository
-RUN apt-get update && apt-get install -y wget xz-utils && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/*
 RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
-RUN echo deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main | tee /etc/apt/sources.list.d/llvm.list
+RUN echo deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main | tee /etc/apt/sources.list.d/llvm.list
 
 # Manually install the kernel.org "Crosstool" based toolchains for gcc-7.3
 RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc-7.3.0-nolibc_aarch64-linux.tar.xz | tar -C /opt -xJ
@@ -52,6 +52,7 @@ RUN apt-get update && apt-get install -y \
 	grub-efi-ia32-bin \
 	iasl \
 	iputils-ping \
+	libisl15 \
 	liblz4-tool \
 	libpixman-1-dev \
 	libpython-dev \
@@ -63,10 +64,8 @@ RUN apt-get update && apt-get install -y \
 	lzop \
 	picocom \
 	python \
-	python-coverage \
 	python-dev \
 	python-pip \
-	python-pytest \
 	python-virtualenv \
 	python3-sphinx \
 	rpm2cpio \
@@ -79,6 +78,9 @@ RUN apt-get update && apt-get install -y \
 	zip \
 	&& rm -rf /var/lib/apt/lists/*
 
+# Manually install libmpfr4 for the toolchains
+RUN wget http://mirrors.kernel.org/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.4-1_amd64.deb && dpkg -i libmpfr4_3.1.4-1_amd64.deb && rm libmpfr4_3.1.4-1_amd64.deb
+
 # Build GRUB UEFI targets grubarm.efi and grubaa64.efi
 RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
 	cd /tmp/grub && \
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH 2/2 Dockerfile: Update to current bionic tag

Quoted 5 lines · Tom Rini

As part of this we stop installing python-pytest (we enforce a specific version via pip in tests) as well as python-coverage (this can and should be done via pip as well).

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191008/57e1983d/attachment.sig>