Merge pull request #1450 from gtardif/better_scripted_install_test

Test install script as non root user (still sudoer to be able to install)
This commit is contained in:
Guillaume Tardif 2021-03-22 14:46:55 +01:00 committed by GitHub
commit d3dbc90fde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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