-
Notifications
You must be signed in to change notification settings - Fork 65
Move tools & configs from /home/user/ to /home/tooling/ #115
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4f70e6d
Manually add sdkman init script launcher to end of .bashrc
AObuchow 48da97d
Use bash-completion package for bash completions
AObuchow bcff886
Manually add nvm bash completion
AObuchow 0b3a58d
Move tools & configs from /home/user/ to /home/tooling/
AObuchow 7225e21
Move tools & configs to /home/tooling/ in UBI8 base image
AObuchow a9669fa
Don't stow .viminfo
AObuchow 0d3e766
Ensure podman wrapper works from /home/tooling/
AObuchow 7ac7971
Don't modify ~/.bashrc, use /etc/profile.d/ instead
AObuchow c88b6ac
Don't recursively chown files in $HOME of base image
AObuchow 0a20adb
Remove obsolete ~/.bashrc creation code from base image entrypoint
AObuchow 72f5307
Fix for multiple KUBEDOCK_PARAMS
AObuchow d3b7f2e
Don't fail entrypoint if kubeconfig could not be found
AObuchow 741bffd
Allow changing kubedock timeout duration with $KUBEDOCK_TIMEOUT
AObuchow 7bda302
Log stow output when run in entrypoint
AObuchow be7d921
Only execute stow the first time container is started
AObuchow 18b26a7
Ensure ~/.bashrc and ~/.bash_profile exist when persistUserHome enabled
AObuchow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# .viminfo cannot be a symlink for security reasons | ||
\.viminfo | ||
|
||
# We store bash related files in /home/tooling/ so they aren't overriden if persistUserHome is enabled | ||
# but we don't want them to be symbolic links (or to cause stow conflicts). They will be copied to /home/user/ manually. | ||
\.bashrc | ||
\.bash_profile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,22 @@ LABEL description="Image with developers tools. Languages SDK and runtimes inclu | |
LABEL io.k8s.display-name="devfile-developer-universal" | ||
LABEL io.openshift.expose-services="" | ||
|
||
USER 0 | ||
|
||
# $PROFILE_EXT contains all additions made to the bash environment | ||
ENV PROFILE_EXT=/etc/profile.d/udi_environment.sh | ||
RUN touch ${PROFILE_EXT} & chown 10001 ${PROFILE_EXT} | ||
|
||
USER 10001 | ||
|
||
# We install everything to /home/tooling/ as /home/user/ may get overriden, see github.com/eclipse/che/issues/22412 | ||
ENV HOME=/home/tooling | ||
|
||
# Java | ||
RUN curl -fsSL "https://get.sdkman.io" | bash \ | ||
&& bash -c ". /home/user/.sdkman/bin/sdkman-init.sh \ | ||
&& sed -i "s/sdkman_auto_answer=false/sdkman_auto_answer=true/g" /home/user/.sdkman/etc/config \ | ||
&& sed -i "s/sdkman_auto_env=false/sdkman_auto_env=true/g" /home/user/.sdkman/etc/config \ | ||
RUN curl -fsSL "https://get.sdkman.io/?rcupdate=false" | bash \ | ||
&& bash -c ". /home/tooling/.sdkman/bin/sdkman-init.sh \ | ||
&& sed -i "s/sdkman_auto_answer=false/sdkman_auto_answer=true/g" /home/tooling/.sdkman/etc/config \ | ||
&& sed -i "s/sdkman_auto_env=false/sdkman_auto_env=true/g" /home/tooling/.sdkman/etc/config \ | ||
&& sdk install java 8.0.332-tem \ | ||
&& sdk install java 11.0.15-tem \ | ||
&& sdk install java 17.0.3-tem \ | ||
|
@@ -34,45 +43,49 @@ RUN curl -fsSL "https://get.sdkman.io" | bash \ | |
&& sdk install jbang \ | ||
&& sdk flush archives \ | ||
&& sdk flush temp" \ | ||
&& chgrp -R 0 /home/user && chmod -R g=u /home/user | ||
&& chgrp -R 0 /home/tooling && chmod -R g=u /home/tooling | ||
|
||
# sdk home java <version> | ||
ENV JAVA_HOME_8=/home/user/.sdkman/candidates/java/8.0.332-tem | ||
ENV JAVA_HOME_11=/home/user/.sdkman/candidates/java/11.0.15-tem | ||
ENV JAVA_HOME_17=/home/user/.sdkman/candidates/java/17.0.3-tem | ||
ENV JAVA_HOME_8=/home/tooling/.sdkman/candidates/java/8.0.332-tem | ||
ENV JAVA_HOME_11=/home/tooling/.sdkman/candidates/java/11.0.15-tem | ||
ENV JAVA_HOME_17=/home/tooling/.sdkman/candidates/java/17.0.3-tem | ||
|
||
# Java-related environment variables are described and set by /home/user/.bashrc | ||
# Java-related environment variables are described and set by ${PROFILE_EXT}, which will be loaded by ~/.bashrc | ||
# To make Java working for dash and other shells, it needs to initialize them in the Dockerfile. | ||
ENV SDKMAN_CANDIDATES_API="https://api.sdkman.io/2" | ||
ENV SDKMAN_CANDIDATES_DIR="/home/user/.sdkman/candidates" | ||
ENV SDKMAN_DIR="/home/user/.sdkman" | ||
ENV SDKMAN_CANDIDATES_DIR="/home/tooling/.sdkman/candidates" | ||
ENV SDKMAN_DIR="/home/tooling/.sdkman" | ||
ENV SDKMAN_PLATFORM="linuxx64" | ||
ENV SDKMAN_VERSION="5.13.0" | ||
|
||
ENV GRADLE_HOME="/home/user/.sdkman/candidates/gradle/current" | ||
ENV JAVA_HOME="/home/user/.sdkman/candidates/java/current" | ||
ENV MAVEN_HOME="/home/user/.sdkman/candidates/maven/current" | ||
ENV GRADLE_HOME="/home/tooling/.sdkman/candidates/gradle/current" | ||
ENV JAVA_HOME="/home/tooling/.sdkman/candidates/java/current" | ||
ENV MAVEN_HOME="/home/tooling/.sdkman/candidates/maven/current" | ||
|
||
ENV GRAALVM_HOME=/home/user/.sdkman/candidates/java/22.1.0.0.r17-mandrel | ||
ENV GRAALVM_HOME=/home/tooling/.sdkman/candidates/java/22.1.0.0.r17-mandrel | ||
|
||
ENV PATH="/home/user/.krew/bin:$PATH" | ||
ENV PATH="/home/user/.sdkman/candidates/maven/current/bin:$PATH" | ||
ENV PATH="/home/user/.sdkman/candidates/java/current/bin:$PATH" | ||
ENV PATH="/home/user/.sdkman/candidates/gradle/current/bin:$PATH" | ||
ENV PATH="/home/user/.local/share/coursier/bin:$PATH" | ||
ENV PATH="/home/tooling/.krew/bin:$PATH" | ||
ENV PATH="/home/tooling/.sdkman/candidates/maven/current/bin:$PATH" | ||
ENV PATH="/home/tooling/.sdkman/candidates/java/current/bin:$PATH" | ||
ENV PATH="/home/tooling/.sdkman/candidates/gradle/current/bin:$PATH" | ||
ENV PATH="/home/tooling/.local/share/coursier/bin:$PATH" | ||
|
||
# NodeJS | ||
ENV NVM_DIR="/home/user/.nvm" | ||
RUN mkdir -p /home/tooling/.nvm/ | ||
ENV NVM_DIR="/home/tooling/.nvm" | ||
ENV NODEJS_20_VERSION=20.7.0 | ||
# note that 18.18.0 is the latest but 18.16.1 is the supported version downstream and in ubi8 | ||
ENV NODEJS_18_VERSION=18.16.1 | ||
ENV NODEJS_DEFAULT_VERSION=${NODEJS_18_VERSION} | ||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash && source /home/user/.bashrc && \ | ||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | PROFILE=/dev/null bash | ||
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> ${PROFILE_EXT} \ | ||
&& echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ${PROFILE_EXT} | ||
RUN source /home/user/.bashrc && \ | ||
nvm install v${NODEJS_20_VERSION} && \ | ||
nvm install v${NODEJS_18_VERSION} && \ | ||
nvm alias default v${NODEJS_DEFAULT_VERSION} && nvm use v${NODEJS_DEFAULT_VERSION} && \ | ||
npm install --global [email protected] &&\ | ||
chgrp -R 0 /home/user && chmod -R g=u /home/user | ||
chgrp -R 0 /home/tooling && chmod -R g=u /home/tooling | ||
ENV PATH=$NVM_DIR/versions/node/v${NODEJS_DEFAULT_VERSION}/bin:$PATH | ||
ENV NODEJS_HOME_20=$NVM_DIR/versions/node/v${NODEJS_20_VERSION} | ||
ENV NODEJS_HOME_18=$NVM_DIR/versions/node/v${NODEJS_18_VERSION} | ||
|
@@ -83,9 +96,10 @@ ENV KUBECONFIG=/home/user/.kube/config | |
USER 0 | ||
|
||
# Define user directory for binaries | ||
RUN mkdir -p /home/user/.local/bin && \ | ||
RUN mkdir -p /home/tooling/.local/bin && \ | ||
chgrp -R 0 /home && chmod -R g=u /home | ||
ENV PATH="/home/user/.local/bin:$PATH" | ||
ENV PATH="/home/tooling/.local/bin:$PATH" | ||
|
||
# Required packages for AWT | ||
RUN dnf install -y libXext libXrender libXtst libXi | ||
|
@@ -109,11 +123,11 @@ RUN curl -fLo mill https://raw.githubusercontent.com/lefou/millw/main/millw && \ | |
RUN dnf -y install llvm-toolset gcc gcc-c++ clang clang-libs clang-tools-extra gdb | ||
|
||
# Go 1.18+ - installed to /usr/bin/go | ||
# gopls 0.10+ - installed to /home/user/go/bin/gopls and /home/user/go/pkg/mod/ | ||
# gopls 0.10+ - installed to /home/tooling/go/bin/gopls and /home/tooling/go/pkg/mod/ | ||
RUN dnf install -y go-toolset && \ | ||
GO111MODULE=on go install -v golang.org/x/tools/gopls@latest && \ | ||
chgrp -R 0 /home/user && chmod -R g=u /home/user | ||
ENV GOBIN="/home/user/go/bin/" | ||
chgrp -R 0 /home/tooling && chmod -R g=u /home/tooling | ||
ENV GOBIN="/home/tooling/go/bin/" | ||
ENV PATH="$GOBIN:$PATH" | ||
|
||
# Python | ||
|
@@ -156,38 +170,33 @@ ENV DOTNET_RPM_VERSION=6.0 | |
RUN dnf install -y dotnet-hostfxr-${DOTNET_RPM_VERSION} dotnet-runtime-${DOTNET_RPM_VERSION} dotnet-sdk-${DOTNET_RPM_VERSION} | ||
|
||
# rust | ||
ENV CARGO_HOME=/home/user/.cargo \ | ||
RUSTUP_HOME=/home/user/.rustup \ | ||
PATH=/home/user/.cargo/bin:${PATH} | ||
ENV CARGO_HOME=/home/tooling/.cargo \ | ||
RUSTUP_HOME=/home/tooling/.rustup \ | ||
PATH=/home/tooling/.cargo/bin:${PATH} | ||
RUN curl --proto '=https' --tlsv1.2 -sSfo rustup https://sh.rustup.rs && \ | ||
chmod +x rustup && \ | ||
mv rustup /usr/bin/ && \ | ||
rustup -y --no-modify-path --profile minimal -c rust-src -c rust-analysis -c rls && \ | ||
chgrp -R 0 /home/user && chmod -R g=u /home/user | ||
chgrp -R 0 /home/tooling && chmod -R g=u /home/tooling | ||
|
||
# camel-k | ||
ENV KAMEL_VERSION 1.11.0 | ||
RUN curl -L https://github.com/apache/camel-k/releases/download/v${KAMEL_VERSION}/camel-k-client-${KAMEL_VERSION}-linux-64bit.tar.gz | tar -C /usr/local/bin -xz \ | ||
&& chmod +x /usr/local/bin/kamel | ||
|
||
# git completion | ||
RUN echo "source /usr/share/bash-completion/completions/git" >> /home/user/.bashrc | ||
|
||
# Cloud | ||
|
||
# oc client and completion | ||
# oc client | ||
ENV OC_VERSION=4.6 | ||
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/clients/oc/${OC_VERSION}/linux/oc.tar.gz | tar -C /usr/local/bin -xz \ | ||
&& chmod +x /usr/local/bin/oc \ | ||
&& oc completion bash > /usr/share/bash-completion/completions/oc \ | ||
&& echo "source /usr/share/bash-completion/completions/oc" >> /home/user/.bashrc | ||
&& chmod +x /usr/local/bin/oc | ||
|
||
## podman buildah skopeo | ||
RUN dnf -y module enable container-tools:rhel8 && \ | ||
dnf -y update && \ | ||
dnf -y reinstall shadow-utils && \ | ||
dnf -y install podman buildah skopeo fuse-overlayfs | ||
RUN echo 'alias docker=podman' >> /home/user/.bashrc | ||
RUN echo 'alias docker=podman' >> ${PROFILE_EXT} | ||
|
||
# Set up environment variables to note that this is | ||
# not starting with usernamespace and default to | ||
|
@@ -235,13 +244,9 @@ EOF2 | |
|
||
dnf install -y kubectl | ||
curl -sSL -o ~/.kubectl_aliases https://raw.githubusercontent.com/ahmetb/kubectl-alias/master/.kubectl_aliases | ||
echo '[ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases' >> /home/user/.bashrc | ||
echo '[ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases' >> ${PROFILE_EXT} | ||
EOF | ||
|
||
# kubectl completion | ||
RUN kubectl completion bash > /usr/share/bash-completion/completions/kubectl \ | ||
&& echo "source /usr/share/bash-completion/completions/kubectl" >> /home/user/.bashrc | ||
|
||
## shellcheck | ||
RUN <<EOF | ||
dnf install -y xz | ||
|
@@ -279,7 +284,7 @@ sha256sum -c "${KREW_TGZ}.sha256" 2>&1 | grep OK | |
|
||
tar -zxvf "${KREW_TGZ}" | ||
./"krew-${KREW_ARCH}" install krew | ||
echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' >> /home/user/.bashrc | ||
echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' >> ${PROFILE_EXT} | ||
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" | ||
# kubens and kubectx | ||
kubectl krew install ns | ||
|
@@ -414,6 +419,26 @@ cd - | |
rm -rf "${TEMP_DIR}" | ||
EOF | ||
|
||
# Bash completions | ||
RUN dnf -y install bash-completion \ | ||
&& dnf clean all \ | ||
&& rm -rf /var/cache/yum | ||
|
||
RUN <<EOF | ||
oc completion bash > /usr/share/bash-completion/completions/oc | ||
kubectl completion bash > /usr/share/bash-completion/completions/kubectl | ||
cat ${NVM_DIR}/bash_completion > /usr/share/bash-completion/completions/nvm | ||
EOF | ||
|
||
## Add sdkman's init script launcher to the end of ${PROFILE_EXT} since we are not adding it on sdkman install | ||
## NOTE: all modifications to ${PROFILE_EXT} must happen BEFORE this step in order for sdkman to function correctly | ||
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 and /home to allow arbitrary users to write | ||
RUN chgrp -R 0 /home && chmod -R g=u /etc/passwd /etc/group /home | ||
|
||
|
@@ -423,3 +448,5 @@ RUN dnf -y clean all --enablerepo='*' | |
COPY --chown=0:0 entrypoint.sh / | ||
|
||
USER 10001 | ||
|
||
ENV HOME=/home/user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.