Skip to content

Commit

Permalink
fix UDI Entrypoint to use Base image entrypoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgruver committed Dec 12, 2024
1 parent 38c22eb commit bc1ee3e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 32 deletions.
21 changes: 21 additions & 0 deletions base/ubi9/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
7 changes: 1 addition & 6 deletions universal/ubi9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# 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

LABEL maintainer="Red Hat, Inc."

LABEL com.redhat.component="devfile-universal-container"
Expand Down Expand Up @@ -413,18 +414,12 @@ 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

# Set permissions on /etc/passwd, /etc/group, /etc/pki and /home to allow arbitrary users to write
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
26 changes: 0 additions & 26 deletions universal/ubi9/entrypoint.sh

This file was deleted.

0 comments on commit bc1ee3e

Please sign in to comment.