Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Entrypoint to use Base image entrypoint #206

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions base/ubi9/.stow-local-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
\.krew
\.sdkman
\.local/bin/podman

# Ignore files under .config directory
\.config
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 "$@"
4 changes: 1 addition & 3 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,7 +414,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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be on the safer side, instead of removing the stow call, could we instead add .config in the stow ignore file here?

We have the stow call here to move certain /home/tooling folders (example) to /home/user.

The stow call might not be entirely necessary since the binaries installed under /home/tooling are being added to the PATH anyways. I'll have to investigate more to be sure whether the stow call can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the stow call during build? I don't think that it does anything useful that isn't done when it runs in the entrypoint.sh

You'll see that exact same syntax is run in entrypoint.sh. When it runs there, it runs as the user not root.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkwon17 I restored the stow command in the Dockerfile.

Expand All @@ -423,8 +423,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
26 changes: 0 additions & 26 deletions universal/ubi9/entrypoint.sh

This file was deleted.

Loading