Docker: Refine smaller-skeleton bashrc setup for all images #5154 #5155

Follow-up to the contributor change that moves shell customization out of
per-user home directories:

- Migrate the resolute, trixie, and questing (+ slim) dev images to the
  shared install-bashrc.sh; the shared create-users.sh now hands users a
  minimal skeleton, so images still writing to /etc/skel/.bashrc would
  otherwise lose their aliases and prompt.
- Restore export PATH="$PATH:$HOME/.local/bin" (needed for claude/gh) in
  the full dev images by writing it to /etc/bash.bashrc; kept out of the
  slim and production images, which never had it.
- Guard the /etc/skel/.config copy in create-users.sh so production images
  without it don't emit a spurious error, and use rm -f /root/.bashrc.
- Fix the install-bashrc.sh header reference and silence an intentional
  SC2016 on the runtime-expanded PS1.
This commit is contained in:
Michael Mayer 2026-07-10 00:56:15 +02:00
parent 44e7ed3f7e
commit c9362a6720
18 changed files with 27 additions and 26 deletions

View file

@ -86,6 +86,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-go.sh && \ /scripts/install-go.sh && \
/scripts/install-go-tools.sh && \ /scripts/install-go-tools.sh && \
/scripts/install-bashrc.sh && \ /scripts/install-bashrc.sh && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \

View file

@ -96,6 +96,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-osv-scanner.sh && \ /scripts/install-osv-scanner.sh && \
/scripts/install-gitleaks.sh && \ /scripts/install-gitleaks.sh && \
/scripts/install-bashrc.sh && \ /scripts/install-bashrc.sh && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \

View file

@ -130,6 +130,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-go-tools.sh && \ /scripts/install-go-tools.sh && \
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \ echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
/scripts/install-bashrc.sh && \ /scripts/install-bashrc.sh && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \
install -d -m 0777 -o 1000 -g 1000 \ install -d -m 0777 -o 1000 -g 1000 \

View file

@ -126,6 +126,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-go-tools.sh && \ /scripts/install-go-tools.sh && \
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \ echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
/scripts/install-bashrc.sh && \ /scripts/install-bashrc.sh && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \
install -d -m 0777 -o 1000 -g 1000 \ install -d -m 0777 -o 1000 -g 1000 \

View file

@ -109,6 +109,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-osv-scanner.sh && \ /scripts/install-osv-scanner.sh && \
/scripts/install-gitleaks.sh && \ /scripts/install-gitleaks.sh && \
/scripts/install-bashrc.sh && \ /scripts/install-bashrc.sh && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \

View file

@ -92,6 +92,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-go-tools.sh && \ /scripts/install-go-tools.sh && \
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \ echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
/scripts/install-bashrc.sh && \ /scripts/install-bashrc.sh && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \

View file

@ -92,6 +92,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-go-tools.sh && \ /scripts/install-go-tools.sh && \
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \ echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
/scripts/install-bashrc.sh && \ /scripts/install-bashrc.sh && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \

View file

@ -97,6 +97,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-go.sh && \ /scripts/install-go.sh && \
/scripts/install-go-tools.sh && \ /scripts/install-go-tools.sh && \
/scripts/install-bashrc.sh && \ /scripts/install-bashrc.sh && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \

View file

@ -100,6 +100,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-go.sh && \ /scripts/install-go.sh && \
/scripts/install-go-tools.sh && \ /scripts/install-go-tools.sh && \
/scripts/install-bashrc.sh && \ /scripts/install-bashrc.sh && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-6/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \

View file

@ -110,6 +110,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-go.sh && \ /scripts/install-go.sh && \
/scripts/install-go-tools.sh && \ /scripts/install-go-tools.sh && \
/scripts/install-bashrc.sh && \ /scripts/install-bashrc.sh && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /scripts/convert/policy.xml /etc/ImageMagick-7/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-7/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \

View file

@ -72,11 +72,9 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-darktable.sh && \ /scripts/install-darktable.sh && \
/scripts/install-yt-dlp.sh && \ /scripts/install-yt-dlp.sh && \
/scripts/install-libheif.sh && \ /scripts/install-libheif.sh && \
echo 'alias ll="ls -alh"' >> /etc/skel/.bashrc && \ /scripts/install-bashrc.sh && \
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
echo "ALL ALL=(ALL) NOPASSWD:SETENV: /scripts/entrypoint-init.sh" >> /etc/sudoers.d/init && \ echo "ALL ALL=(ALL) NOPASSWD:SETENV: /scripts/entrypoint-init.sh" >> /etc/sudoers.d/init && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /etc/skel/.bashrc /root/.bashrc && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \
install -d -m 0777 -o 1000 -g 1000 \ install -d -m 0777 -o 1000 -g 1000 \
/photoprism/originals \ /photoprism/originals \

View file

@ -112,11 +112,9 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-hadolint.sh && \ /scripts/install-hadolint.sh && \
/scripts/install-osv-scanner.sh && \ /scripts/install-osv-scanner.sh && \
/scripts/install-gitleaks.sh && \ /scripts/install-gitleaks.sh && \
echo 'alias go=richgo ll="ls -alh"' >> /etc/skel/.bashrc && \ /scripts/install-bashrc.sh && \
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \ echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/skel/.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /etc/skel/.bashrc /root/.bashrc && \
cp /scripts/convert/policy.xml /etc/ImageMagick-7/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-7/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \
install -d -m 0777 -o 1000 -g 1000 \ install -d -m 0777 -o 1000 -g 1000 \

View file

@ -73,11 +73,9 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-darktable.sh && \ /scripts/install-darktable.sh && \
/scripts/install-yt-dlp.sh && \ /scripts/install-yt-dlp.sh && \
/scripts/install-libheif.sh && \ /scripts/install-libheif.sh && \
echo 'alias ll="ls -alh"' >> /etc/skel/.bashrc && \ /scripts/install-bashrc.sh && \
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
echo "ALL ALL=(ALL) NOPASSWD:SETENV: /scripts/entrypoint-init.sh" >> /etc/sudoers.d/init && \ echo "ALL ALL=(ALL) NOPASSWD:SETENV: /scripts/entrypoint-init.sh" >> /etc/sudoers.d/init && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /etc/skel/.bashrc /root/.bashrc && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \
install -d -m 0777 -o 1000 -g 1000 \ install -d -m 0777 -o 1000 -g 1000 \
/photoprism/originals \ /photoprism/originals \

View file

@ -113,11 +113,9 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-hadolint.sh && \ /scripts/install-hadolint.sh && \
/scripts/install-osv-scanner.sh && \ /scripts/install-osv-scanner.sh && \
/scripts/install-gitleaks.sh && \ /scripts/install-gitleaks.sh && \
echo 'alias go=richgo ll="ls -alh"' >> /etc/skel/.bashrc && \ /scripts/install-bashrc.sh && \
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \ echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/skel/.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /etc/skel/.bashrc /root/.bashrc && \
cp /scripts/convert/policy.xml /etc/ImageMagick-7/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-7/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \
install -d -m 0777 -o 1000 -g 1000 \ install -d -m 0777 -o 1000 -g 1000 \

View file

@ -71,11 +71,9 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
libmatroska-dev libdvdread-dev libebml5 libgav1-bin libatomic1 \ libmatroska-dev libdvdread-dev libebml5 libgav1-bin libatomic1 \
va-driver-all libva2 iputils-ping dnsutils binutils binutils-gold \ va-driver-all libva2 iputils-ping dnsutils binutils binutils-gold \
&& \ && \
echo 'alias ll="ls -alh"' >> /etc/skel/.bashrc && \ /scripts/install-bashrc.sh && \
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
echo "ALL ALL=(ALL) NOPASSWD:SETENV: /scripts/entrypoint-init.sh" >> /etc/sudoers.d/init && \ echo "ALL ALL=(ALL) NOPASSWD:SETENV: /scripts/entrypoint-init.sh" >> /etc/sudoers.d/init && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /etc/skel/.bashrc /root/.bashrc && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \
install -d -m 0777 -o 1000 -g 1000 \ install -d -m 0777 -o 1000 -g 1000 \
/photoprism/originals \ /photoprism/originals \

View file

@ -99,11 +99,9 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/scripts/install-hadolint.sh && \ /scripts/install-hadolint.sh && \
/scripts/install-osv-scanner.sh && \ /scripts/install-osv-scanner.sh && \
/scripts/install-gitleaks.sh && \ /scripts/install-gitleaks.sh && \
echo 'alias go=richgo ll="ls -alh"' >> /etc/skel/.bashrc && \ /scripts/install-bashrc.sh && \
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \ echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc && \
echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/skel/.bashrc && \
/scripts/install-dircolors.sh && \ /scripts/install-dircolors.sh && \
cp /etc/skel/.bashrc /root/.bashrc && \
cp /scripts/convert/policy.xml /etc/ImageMagick-7/policy.xml && \ cp /scripts/convert/policy.xml /etc/ImageMagick-7/policy.xml && \
/scripts/create-users.sh && \ /scripts/create-users.sh && \
install -d -m 0777 -o 1000 -g 1000 \ install -d -m 0777 -o 1000 -g 1000 \

View file

@ -43,8 +43,10 @@ usermod -a -G photoprism,video,davfs2,renderd,render,ssl-cert,videodriver www-da
SKELETON="/tmp/custom-skeleton" SKELETON="/tmp/custom-skeleton"
mkdir --parents "${SKELETON}" mkdir --parents "${SKELETON}"
# copy the .config/ directory from the default skeleton # copy the .config/ directory from the default skeleton, if it exists
cp -r /etc/skel/.config/ ${SKELETON}/.config/ if [ -d /etc/skel/.config ]; then
cp -r /etc/skel/.config/ "${SKELETON}/.config/"
fi
# create user 'videodriver' # create user 'videodriver'
userdel -r -f videodriver >/dev/null 2>&1 userdel -r -f videodriver >/dev/null 2>&1

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Add go alias and custom prompt in /etc/bash.bashrc: # Adds shell aliases and a custom prompt to /etc/bash.bashrc:
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-profile.sh) # bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-bashrc.sh)
# Abort if not executed as root. # Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then if [[ $(id -u) != "0" ]]; then
@ -14,6 +14,7 @@ set -e
echo "Add ll alias and custom prompt in /etc/bash.bashrc" echo "Add ll alias and custom prompt in /etc/bash.bashrc"
echo 'alias ll="ls -alh"' >> /etc/bash.bashrc echo 'alias ll="ls -alh"' >> /etc/bash.bashrc
# shellcheck disable=SC2016 # $DOCKER_TAG is expanded at shell runtime, not here.
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/bash.bashrc echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/bash.bashrc
echo "Add alias of go to richgo if it's available" echo "Add alias of go to richgo if it's available"
@ -25,4 +26,4 @@ fi
echo "Remove the unnecessary custom .bashrc for the root user" echo "Remove the unnecessary custom .bashrc for the root user"
rm /root/.bashrc rm -f /root/.bashrc