From 9df969bd10046dbe6cbeefc34e09377ae96c798b Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Mon, 22 Mar 2021 14:22:05 +0100 Subject: [PATCH] Test install script as non root user (still sudoer to be able to install) Signed-off-by: Guillaume Tardif --- scripts/install/test.Dockerfile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/install/test.Dockerfile b/scripts/install/test.Dockerfile index 10d1fedc9..c19caebee 100644 --- a/scripts/install/test.Dockerfile +++ b/scripts/install/test.Dockerfile @@ -24,13 +24,25 @@ FROM centos:7 AS base-centos RUN curl https://get.docker.com | sh FROM base-${DISTRO} AS install + +RUN apt-get update && apt-get -y install sudo +RUN adduser --disabled-password --gecos '' newuser +RUN adduser newuser sudo +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +USER newuser +WORKDIR /home/newuser + COPY install_linux.sh /scripts/install_linux.sh -RUN chmod +x /scripts/install_linux.sh +RUN sudo chmod +x /scripts/install_linux.sh ARG DOWNLOAD_URL= RUN DOWNLOAD_URL=${DOWNLOAD_URL} /scripts/install_linux.sh RUN docker version | grep Cloud FROM install AS upgrade + +USER newuser +WORKDIR /home/newuser + RUN DOWNLOAD_URL=${DOWNLOAD_URL} /scripts/install_linux.sh RUN docker version | grep Cloud