Skip to content

Commit

Permalink
Remove /home/tooling/.local
Browse files Browse the repository at this point in the history
Signed-off-by: David Kwon <[email protected]>
  • Loading branch information
dkwon17 committed Aug 15, 2024
1 parent 888d46a commit 5e905f7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
11 changes: 4 additions & 7 deletions base/ubi8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.n
RUN dnf -y module enable container-tools:rhel8 && \
dnf -y update && \
dnf -y reinstall shadow-utils && \
dnf -y install podman buildah skopeo fuse-overlayfs
dnf -y install podman buildah skopeo fuse-overlayfs && \
dnf clean all

## gh-cli
RUN \
Expand Down Expand Up @@ -97,12 +98,8 @@ RUN \
cd - && \
rm -rf "${TEMP_DIR}"


# Define user directory for binaries
RUN mkdir -p /home/tooling/.local/bin && \
chgrp -R 0 /home && chmod -R g=u /home && chown -R 10001 /home/tooling
ENV PATH="/home/user/.local/bin:$PATH"
ENV PATH="/home/tooling/.local/bin:$PATH"

# Set up environment variables to note that this is
# not starting with usernamespace and default to
Expand Down Expand Up @@ -135,11 +132,11 @@ COPY --chown=0:0 kubedock_setup.sh /usr/local/bin/kubedock_setup

# Configure Podman wrapper
ENV PODMAN_WRAPPER_PATH=/usr/bin/podman.wrapper
ENV PODMAN_ORIGINAL_PATH=/usr/bin/podman.orig
ENV ORIGINAL_PODMAN_PATH=/usr/bin/podman.orig
COPY --chown=0:0 podman-wrapper.sh "${PODMAN_WRAPPER_PATH}"

COPY --chown=0:0 podman-wrapper.sh /usr/bin/podman.wrapper
RUN mv /usr/bin/podman /usr/bin/podman.orig
RUN mv /usr/bin/podman "${ORIGINAL_PODMAN_PATH}"

COPY --chown=0:0 entrypoint.sh /
COPY --chown=0:0 .stow-local-ignore /home/tooling/
Expand Down
10 changes: 8 additions & 2 deletions base/ubi8/kubedock_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# Kubedock setup script meant to be run from the entrypoint script.

LOCAL_BIN=/home/user/.local/bin
ORIGINAL_PODMAN_PATH=${ORIGINAL_PODMAN_PATH:-"/usr/bin/podman.orig"}
PODMAN_WRAPPER_PATH=${PODMAN_WRAPPER_PATH:-"/usr/bin/podman.wrapper"}

mkdir -p "${LOCAL_BIN}"

if [ "${KUBEDOCK_ENABLED:-false}" = "true" ]; then
echo
echo "Kubedock is enabled (env variable KUBEDOCK_ENABLED is set to true)."
Expand Down Expand Up @@ -29,7 +35,7 @@ if [ "${KUBEDOCK_ENABLED:-false}" = "true" ]; then

echo "Replacing podman with podman-wrapper..."

ln -f -s /usr/bin/podman.wrapper /home/tooling/.local/bin/podman
ln -f -s "${PODMAN_WRAPPER_PATH}" "${LOCAL_BIN}/podman"

export TESTCONTAINERS_RYUK_DISABLED="true"
export TESTCONTAINERS_CHECKS_DISABLE="true"
Expand All @@ -45,5 +51,5 @@ else
echo "Kubedock is disabled. It can be enabled with the env variable \"KUBEDOCK_ENABLED=true\""
echo "set in the workspace Devfile or in a Kubernetes ConfigMap in the developer namespace."
echo
ln -f -s /usr/bin/podman.orig /home/tooling/.local/bin/podman
ln -f -s "${ORIGINAL_PODMAN_PATH}" "${LOCAL_BIN}/podman"
fi
6 changes: 3 additions & 3 deletions base/ubi8/podman-wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -euo pipefail

ORIGINAL_PODMAN_PATH=${ORIGINAL_PODMAN_PATH:-"/usr/bin/podman.orig"}
PODMAN_ORIGINAL_PATH=${PODMAN_ORIGINAL_PATH:-"/usr/bin/podman.orig"}
KUBEDOCK_SUPPORTED_COMMANDS=${KUBEDOCK_SUPPORTED_COMMANDS:-"run ps exec cp logs inspect kill rm wait stop start"}

PODMAN_ARGS=( "$@" )
Expand All @@ -10,11 +10,11 @@ TRUE=0
FALSE=1

exec_original_podman() {
exec ${ORIGINAL_PODMAN_PATH} "${PODMAN_ARGS[@]}"
exec ${PODMAN_ORIGINAL_PATH} "${PODMAN_ARGS[@]}"
}

exec_kubedock_podman() {
exec env CONTAINER_HOST=tcp://127.0.0.1:2475 "${ORIGINAL_PODMAN_PATH}" "${PODMAN_ARGS[@]}"
exec env CONTAINER_HOST=tcp://127.0.0.1:2475 "${PODMAN_ORIGINAL_PATH}" "${PODMAN_ARGS[@]}"
}

podman_command() {
Expand Down

0 comments on commit 5e905f7

Please sign in to comment.