diff --git a/base/ubi9/.stow-local-ignore b/base/ubi9/.stow-local-ignore index e4a7df98..7012d319 100644 --- a/base/ubi9/.stow-local-ignore +++ b/base/ubi9/.stow-local-ignore @@ -10,3 +10,6 @@ \.krew \.sdkman \.local/bin/podman + +# Ignore files under .config directory +\.config diff --git a/base/ubi9/entrypoint.sh b/base/ubi9/entrypoint.sh index 0754ce5a..6ddfee72 100644 --- a/base/ubi9/entrypoint.sh +++ b/base/ubi9/entrypoint.sh @@ -30,4 +30,25 @@ fi source kubedock_setup +# Stow +## Required for https://github.com/eclipse/che/issues/22412 + +# /home/user/ will be mounted to by a PVC if persistUserHome is enabled +mountpoint -q /home/user/; HOME_USER_MOUNTED=$? + +# This file will be created after stowing, to guard from executing stow everytime the container is started +STOW_COMPLETE=/home/user/.stow_completed + +if [ $HOME_USER_MOUNTED -eq 0 ] && [ ! -f $STOW_COMPLETE ]; then + # Create symbolic links from /home/tooling/ -> /home/user/ + stow . -t /home/user/ -d /home/tooling/ --no-folding -v 2 > /tmp/stow.log 2>&1 + # Vim does not permit .viminfo to be a symbolic link for security reasons, so manually copy it + cp /home/tooling/.viminfo /home/user/.viminfo + # We have to restore bash-related files back onto /home/user/ (since they will have been overwritten by the PVC) + # but we don't want them to be symbolic links (so that they persist on the PVC) + cp /home/tooling/.bashrc /home/user/.bashrc + cp /home/tooling/.bash_profile /home/user/.bash_profile + touch $STOW_COMPLETE +fi + exec "$@" diff --git a/universal/ubi9/Dockerfile b/universal/ubi9/Dockerfile index 8f6fa3b0..7bed02da 100644 --- a/universal/ubi9/Dockerfile +++ b/universal/ubi9/Dockerfile @@ -1,7 +1,9 @@ # syntax=docker/dockerfile:1.3-labs # updateBaseImages.sh can't operate on SHA-based tags as they're not date-based or semver-sequential, and therefore cannot be ordered -FROM quay.io/devfile/base-developer-image:ubi9-latest +# FROM quay.io/devfile/base-developer-image:ubi9-latest +FROM quay.io/cgruver0/che/base-developer-image:latest + LABEL maintainer="Red Hat, Inc." LABEL com.redhat.component="devfile-universal-container" @@ -413,7 +415,6 @@ EOF RUN echo 'export SDKMAN_DIR="/home/tooling/.sdkman"' >> ${PROFILE_EXT} RUN echo '[[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh"' >> ${PROFILE_EXT} - # Create symbolic links from /home/tooling/ -> /home/user/ RUN stow . -t /home/user/ -d /home/tooling/ --no-folding @@ -423,8 +424,6 @@ RUN chgrp -R 0 /home && chmod -R g=u /etc/passwd /etc/group /home /etc/pki # cleanup dnf cache RUN dnf -y clean all --enablerepo='*' -COPY --chown=0:0 entrypoint.sh / - USER 10001 ENV HOME=/home/user diff --git a/universal/ubi9/entrypoint.sh b/universal/ubi9/entrypoint.sh deleted file mode 100755 index aeb28436..00000000 --- a/universal/ubi9/entrypoint.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -source kubedock_setup - -# Stow -## Required for https://github.com/eclipse/che/issues/22412 - -# /home/user/ will be mounted to by a PVC if persistUserHome is enabled -mountpoint -q /home/user/; HOME_USER_MOUNTED=$? - -# This file will be created after stowing, to guard from executing stow everytime the container is started -STOW_COMPLETE=/home/user/.stow_completed - -if [ $HOME_USER_MOUNTED -eq 0 ] && [ ! -f $STOW_COMPLETE ]; then - # Create symbolic links from /home/tooling/ -> /home/user/ - stow . -t /home/user/ -d /home/tooling/ --no-folding -v 2 > /tmp/stow.log 2>&1 - # Vim does not permit .viminfo to be a symbolic link for security reasons, so manually copy it - cp /home/tooling/.viminfo /home/user/.viminfo - # We have to restore bash-related files back onto /home/user/ (since they will have been overwritten by the PVC) - # but we don't want them to be symbolic links (so that they persist on the PVC) - cp /home/tooling/.bashrc /home/user/.bashrc - cp /home/tooling/.bash_profile /home/user/.bash_profile - touch $STOW_COMPLETE -fi - -exec "$@"