Skip to content

Commit

Permalink
Docker USER env added
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller authored Oct 9, 2023
1 parent 375d943 commit 85eb100
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 24 deletions.
9 changes: 5 additions & 4 deletions ci/Dockerfile.bullseye.test_install.amd64
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM debian:bullseye
ENV DOCKER_RUNNING=true
ENV USER=pi

COPY . /code
WORKDIR /code

RUN groupadd --gid 1000 pi ;\
useradd -u 1000 -g 1000 -G sudo -d /home/pi -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' pi ;\
chown -R 1000:1000 /code /home/pi ;\
useradd -u 1000 -g 1000 -G sudo -d /home/$USER -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER ;\
chown -R 1000:1000 /code /home/$USER ;\
chmod +x /code/scripts/installscripts/buster-install-default.sh ;\
chmod +x /code/scripts/installscripts/tests/run_installation_tests.sh ;\
chmod +x /code/scripts/installscripts/tests/run_installation_tests2.sh ;\
Expand All @@ -19,7 +20,7 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
echo 'deb http://archive.raspberrypi.org/debian/ bullseye main' >> /etc/apt/sources.list.d/raspi.list ;\
curl http://raspbian.raspberrypi.org/raspbian.public.key | apt-key add - ;\
curl http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | apt-key add - ;\
echo 'pi ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/pi ;\
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER ;\
apt-get clean ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

Expand All @@ -31,4 +32,4 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
touch /boot/cmdlinetxt ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

USER pi
USER $USER
9 changes: 5 additions & 4 deletions ci/Dockerfile.bullseye.test_install.armv7
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM --platform=linux/arm/v7 arm32v7/debian:bullseye-slim
ENV DOCKER_RUNNING=true
ENV USER=pi

COPY . /code
WORKDIR /code

RUN groupadd --gid 1000 pi ;\
useradd -u 1000 -g 1000 -G sudo -d /home/pi -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' pi ;\
chown -R 1000:1000 /code /home/pi ;\
useradd -u 1000 -g 1000 -G sudo -d /home/$USER -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER ;\
chown -R 1000:1000 /code /home/$USER ;\
chmod +x /code/scripts/installscripts/buster-install-default.sh ;\
chmod +x /code/scripts/installscripts/tests/run_installation_tests.sh ;\
chmod +x /code/scripts/installscripts/tests/run_installation_tests2.sh ;\
Expand All @@ -19,7 +20,7 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
echo 'deb http://archive.raspberrypi.org/debian/ bullseye main' >> /etc/apt/sources.list.d/raspi.list ;\
curl http://raspbian.raspberrypi.org/raspbian.public.key | apt-key add - ;\
curl http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | apt-key add - ;\
echo 'pi ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/pi ;\
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER ;\
apt-get clean ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

Expand All @@ -33,7 +34,7 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
touch /boot/cmdlinetxt ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

USER pi
USER $USER



9 changes: 5 additions & 4 deletions ci/Dockerfile.bullseye.test_install_altuser.armv7
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM --platform=linux/arm/v7 arm32v7/debian:bullseye-slim
ENV DOCKER_RUNNING=true
ENV USER=hans

COPY . /code
WORKDIR /code

RUN groupadd --gid 1000 wurst ;\
useradd -u 1000 -g 1000 -G sudo -d /home/hans -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' hans ;\
chown -R 1000:1000 /code /home/hans ;\
useradd -u 1000 -g 1000 -G sudo -d /home/$USER -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER ;\
chown -R 1000:1000 /code /home/$USER ;\
chmod +x /code/scripts/installscripts/buster-install-default.sh ;\
chmod +x /code/scripts/installscripts/tests/run_installation_tests_altuser.sh ;\
chmod +x /code/scripts/installscripts/tests/run_installation_tests2_altuser.sh ;\
Expand All @@ -21,7 +22,7 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
echo 'deb http://archive.raspberrypi.org/debian/ bullseye main' >> /etc/apt/sources.list.d/raspi.list ;\
curl http://raspbian.raspberrypi.org/raspbian.public.key | apt-key add - ;\
curl http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | apt-key add - ;\
echo 'hans ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/hans ;\
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER ;\
apt-get clean ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

Expand All @@ -33,4 +34,4 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
touch /boot/cmdlinetxt ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

USER hans
USER $USER
9 changes: 5 additions & 4 deletions ci/Dockerfile.buster.amd64
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM debian:buster
ENV DOCKER_RUNNING=true
ENV USER=pi

COPY . /code
WORKDIR /code

RUN groupadd --gid 1000 pi ;\
useradd -u 1000 -g 1000 -G sudo -d /home/pi -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' pi ;\
chown -R 1000:1000 /code /home/pi ;\
useradd -u 1000 -g 1000 -G sudo -d /home/$USER -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER ;\
chown -R 1000:1000 /code /home/$USER ;\
chmod +x /code/scripts/installscripts/buster-install-default.sh

RUN export DEBIAN_FRONTEND=noninteractive ;\
Expand All @@ -16,7 +17,7 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
echo 'deb http://archive.raspberrypi.org/debian/ buster main' >> /etc/apt/sources.list.d/raspi.list ;\
curl http://raspbian.raspberrypi.org/raspbian.public.key | apt-key add - ;\
curl http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | apt-key add - ;\
echo 'pi ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/pi ;\
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER ;\
apt-get clean ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

Expand All @@ -28,4 +29,4 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
touch /boot/cmdline.txt /etc/sysctl.conf ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

USER pi
USER $USER
9 changes: 5 additions & 4 deletions ci/Dockerfile.buster.armv7
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM arm32v7/debian:buster-slim
ENV DOCKER_RUNNING=true
ENV USER=pi

COPY . /code
WORKDIR /code

RUN groupadd --gid 1000 pi ;\
useradd -u 1000 -g 1000 -G sudo -d /home/pi -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' pi ;\
chown -R 1000:1000 /code /home/pi ;\
useradd -u 1000 -g 1000 -G sudo -d /home/$USER -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER ;\
chown -R 1000:1000 /code /home/$USER ;\
chmod +x /code/scripts/installscripts/buster-install-default.sh

RUN export DEBIAN_FRONTEND=noninteractive ;\
Expand All @@ -16,7 +17,7 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
echo 'deb http://archive.raspberrypi.org/debian/ buster main' > /etc/apt/sources.list.d/raspi.list ;\
curl http://raspbian.raspberrypi.org/raspbian.public.key | apt-key add - ;\
curl http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | apt-key add - ;\
echo 'pi ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/pi ;\
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER ;\
apt-get clean ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

Expand All @@ -28,4 +29,4 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
touch /boot/cmdline.txt /etc/sysctl.conf ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

USER pi
USER $USER
9 changes: 5 additions & 4 deletions ci/Dockerfile.buster.test_install.armv7
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM --platform=linux/arm/v7 arm32v7/debian:buster-slim
ENV DOCKER_RUNNING=true
ENV USER=pi

COPY . /code
WORKDIR /code

RUN groupadd --gid 1000 pi ;\
useradd -u 1000 -g 1000 -G sudo -d /home/pi -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' pi ;\
chown -R 1000:1000 /code /home/pi ;\
useradd -u 1000 -g 1000 -G sudo -d /home/$USER -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER ;\
chown -R 1000:1000 /code /home/$USER ;\
chmod +x /code/scripts/installscripts/buster-install-default.sh ;\
chmod +x /code/scripts/installscripts/tests/run_installation_tests.sh ;\
chmod +x /code/scripts/installscripts/tests/run_installation_tests2.sh ;\
Expand All @@ -21,7 +22,7 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
echo 'deb http://archive.raspberrypi.org/debian/ buster main' >> /etc/apt/sources.list.d/raspi.list ;\
curl http://raspbian.raspberrypi.org/raspbian.public.key | apt-key add - ;\
curl http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | apt-key add - ;\
echo 'pi ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/pi ;\
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER ;\
apt-get clean ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

Expand All @@ -33,4 +34,4 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
touch /boot/cmdlinetxt ;\
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

USER pi
USER $USER

0 comments on commit 85eb100

Please sign in to comment.