Test install script as non root user (still sudoer to be able to install)

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
Guillaume Tardif 2021-03-22 14:22:05 +01:00
parent 9d8284d35d
commit 9df969bd10
1 changed files with 13 additions and 1 deletions

View File

@ -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