Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 9df969b

Browse files
committed
Test install script as non root user (still sudoer to be able to install)
Signed-off-by: Guillaume Tardif <[email protected]>
1 parent 9d8284d commit 9df969b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

scripts/install/test.Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,25 @@ FROM centos:7 AS base-centos
2424
RUN curl https://get.docker.com | sh
2525

2626
FROM base-${DISTRO} AS install
27+
28+
RUN apt-get update && apt-get -y install sudo
29+
RUN adduser --disabled-password --gecos '' newuser
30+
RUN adduser newuser sudo
31+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
32+
USER newuser
33+
WORKDIR /home/newuser
34+
2735
COPY install_linux.sh /scripts/install_linux.sh
28-
RUN chmod +x /scripts/install_linux.sh
36+
RUN sudo chmod +x /scripts/install_linux.sh
2937
ARG DOWNLOAD_URL=
3038
RUN DOWNLOAD_URL=${DOWNLOAD_URL} /scripts/install_linux.sh
3139
RUN docker version | grep Cloud
3240

3341
FROM install AS upgrade
42+
43+
USER newuser
44+
WORKDIR /home/newuser
45+
3446
RUN DOWNLOAD_URL=${DOWNLOAD_URL} /scripts/install_linux.sh
3547
RUN docker version | grep Cloud
3648

0 commit comments

Comments
 (0)