Skip to content

Commit bc1ee3e

Browse files
author
cgruver
committed
fix UDI Entrypoint to use Base image entrypoint.
1 parent 38c22eb commit bc1ee3e

File tree

3 files changed

+22
-32
lines changed

3 files changed

+22
-32
lines changed

base/ubi9/entrypoint.sh

+21
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,25 @@ fi
3030

3131
source kubedock_setup
3232

33+
# Stow
34+
## Required for https://github.com/eclipse/che/issues/22412
35+
36+
# /home/user/ will be mounted to by a PVC if persistUserHome is enabled
37+
mountpoint -q /home/user/; HOME_USER_MOUNTED=$?
38+
39+
# This file will be created after stowing, to guard from executing stow everytime the container is started
40+
STOW_COMPLETE=/home/user/.stow_completed
41+
42+
if [ $HOME_USER_MOUNTED -eq 0 ] && [ ! -f $STOW_COMPLETE ]; then
43+
# Create symbolic links from /home/tooling/ -> /home/user/
44+
stow . -t /home/user/ -d /home/tooling/ --no-folding -v 2 > /tmp/stow.log 2>&1
45+
# Vim does not permit .viminfo to be a symbolic link for security reasons, so manually copy it
46+
cp /home/tooling/.viminfo /home/user/.viminfo
47+
# We have to restore bash-related files back onto /home/user/ (since they will have been overwritten by the PVC)
48+
# but we don't want them to be symbolic links (so that they persist on the PVC)
49+
cp /home/tooling/.bashrc /home/user/.bashrc
50+
cp /home/tooling/.bash_profile /home/user/.bash_profile
51+
touch $STOW_COMPLETE
52+
fi
53+
3354
exec "$@"

universal/ubi9/Dockerfile

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# updateBaseImages.sh can't operate on SHA-based tags as they're not date-based or semver-sequential, and therefore cannot be ordered
44
FROM quay.io/devfile/base-developer-image:ubi9-latest
5+
56
LABEL maintainer="Red Hat, Inc."
67

78
LABEL com.redhat.component="devfile-universal-container"
@@ -413,18 +414,12 @@ EOF
413414
RUN echo 'export SDKMAN_DIR="/home/tooling/.sdkman"' >> ${PROFILE_EXT}
414415
RUN echo '[[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh"' >> ${PROFILE_EXT}
415416

416-
417-
# Create symbolic links from /home/tooling/ -> /home/user/
418-
RUN stow . -t /home/user/ -d /home/tooling/ --no-folding
419-
420417
# Set permissions on /etc/passwd, /etc/group, /etc/pki and /home to allow arbitrary users to write
421418
RUN chgrp -R 0 /home && chmod -R g=u /etc/passwd /etc/group /home /etc/pki
422419

423420
# cleanup dnf cache
424421
RUN dnf -y clean all --enablerepo='*'
425422

426-
COPY --chown=0:0 entrypoint.sh /
427-
428423
USER 10001
429424

430425
ENV HOME=/home/user

universal/ubi9/entrypoint.sh

-26
This file was deleted.

0 commit comments

Comments
 (0)