forked from MiczFlor/RPi-Jukebox-RFID
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance optimization for container
- Loading branch information
1 parent
e812b89
commit c10a857
Showing
5 changed files
with
54 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,54 @@ | ||
FROM --platform=linux/arm/v7 arm32v7/debian:bullseye-slim | ||
ARG USER_NAME=pi | ||
ARG USER_GROUP=$USER_NAME | ||
ARG GIT_BRANCH | ||
ARG GIT_URL | ||
|
||
# Define constants | ||
ENV DOCKER_RUNNING=true | ||
ENV USER=$USER_NAME | ||
ENV GIT_BRANCH=$GIT_BRANCH | ||
ENV GIT_URL=$GIT_URL | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN touch /boot/cmdlinetxt | ||
|
||
COPY . /code | ||
WORKDIR /code | ||
|
||
RUN groupadd --gid 1000 $USER_GROUP ;\ | ||
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 ;\ | ||
chmod +x /code/scripts/installscripts/tests/run_installation_tests3.sh | ||
|
||
RUN export DEBIAN_FRONTEND=noninteractive ;\ | ||
apt-get update ;\ | ||
apt-get -y install curl gnupg sudo nano systemd apt-utils ;\ | ||
echo 'deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi' > /etc/apt/sources.list.d/raspi.list ;\ | ||
# Install all packages | ||
RUN echo 'deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi' > /etc/apt/sources.list.d/raspi.list ;\ | ||
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 "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER ;\ | ||
apt-get clean ;\ | ||
rm -rf /var/cache/apt/* /var/lib/apt/lists/* | ||
|
||
RUN export DEBIAN_FRONTEND=noninteractive ;\ | ||
apt-get update ;\ | ||
# install here to speed up GitHub Action | ||
apt-get -y install raspberrypi-kernel-headers ;\ | ||
apt-get -y dist-upgrade --auto-remove --purge ;\ | ||
apt-get -y install wget build-essential git iw locales wpasupplicant ;\ | ||
apt-get clean ;\ | ||
touch /boot/cmdlinetxt ;\ | ||
rm -rf /var/cache/apt/* /var/lib/apt/lists/* | ||
apt-get update && \ | ||
apt-get -y install \ | ||
apt-utils \ | ||
build-essential \ | ||
curl \ | ||
git \ | ||
gnupg \ | ||
iw \ | ||
locales \ | ||
nano \ | ||
# install here to speed up GitHub Action | ||
raspberrypi-kernel-headers \ | ||
sudo \ | ||
systemd \ | ||
wget \ | ||
wpasupplicant && \ | ||
apt-get -y dist-upgrade --auto-remove --purge && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Define user info that my change. Therefore after package installation | ||
ARG USER_NAME=pi | ||
ARG USER_GROUP=$USER_NAME | ||
ENV USER=$USER_NAME | ||
|
||
RUN groupadd --gid 1000 $USER_GROUP && \ | ||
useradd -u 1000 -g 1000 -G sudo -d /home/$USER -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER && \ | ||
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER | ||
|
||
# Define need files for installation test | ||
COPY --chown=1000:1000 --chmod=+x scripts/installscripts/tests/run_installation_tests*.sh /test/ | ||
COPY --chown=1000:1000 --chmod=+x scripts/installscripts/buster-install-default.sh / | ||
|
||
WORKDIR /test | ||
|
||
# Define Git Repo variables which frequently change | ||
ARG GIT_BRANCH | ||
ARG GIT_URL | ||
ENV GIT_BRANCH=$GIT_BRANCH | ||
ENV GIT_URL=$GIT_URL | ||
|
||
USER $USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters