Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c5e0a96

Browse files
committed
Remove extra binaries and add oc bash completion
1 parent 801a4df commit c5e0a96

File tree

4 files changed

+11
-99
lines changed

4 files changed

+11
-99
lines changed

Containerfile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ FROM quay.io/fedora/fedora:41
33

44
ARG USER_HOME_DIR="/home/user"
55
ARG WORK_DIR="/projects"
6-
ARG INSTALL_PACKAGES="procps-ng openssl git tar gzip zip xz unzip which shadow-utils bash zsh vi wget jq gh podman buildah skopeo podman-docker glibc-devel zlib-devel gcc libffi-devel libstdc++-devel gcc-c++ glibc-langpack-en ca-certificates python3-pip python3-devel fuse-overlayfs util-linux vim-minimal vim-enhanced"
6+
ARG INSTALL_PACKAGES="procps-ng openssl git tar gzip zip xz unzip which shadow-utils bash bash-completion zsh vi wget jq gh podman buildah skopeo podman-docker glibc-devel zlib-devel gcc libffi-devel libstdc++-devel gcc-c++ glibc-langpack-en ca-certificates python3-pip python3-devel fuse-overlayfs util-linux vim-minimal vim-enhanced"
77

88
ENV HOME=${USER_HOME_DIR} \
99
KUBECONFIG=/home/user/.kube/config \
1010
BUILDAH_ISOLATION=chroot \
1111
PATH="/home/user/.local/bin:${PATH:-/bin:/usr/bin}"
1212

1313
COPY --chown=0:0 tools/entrypoint.sh /
14-
COPY --chown=0:0 tools/podman-wrapper.sh /usr/bin/
15-
COPY --chown=0:0 tools/kubedock /usr/bin
1614

1715
RUN microdnf install -y ${INSTALL_PACKAGES}; \
1816
microdnf update -y ; \
@@ -45,21 +43,18 @@ ENV DOTNET_RPM_VERSION=9.0
4543
RUN dnf install -y dotnet-hostfxr-${DOTNET_RPM_VERSION} dotnet-runtime-${DOTNET_RPM_VERSION} dotnet-sdk-${DOTNET_RPM_VERSION}
4644

4745
# Install oc cli
48-
ENV OC_VERSION=openshift-client-linux-4.17.22
46+
ENV OC_BINARY=openshift-client-linux
4947

50-
RUN wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable-4.17/${OC_VERSION}.tar.gz && \
51-
gzip -dvf ${OC_VERSION}.tar.gz && tar -xvf ${OC_VERSION}.tar && \
52-
chmod 755 oc && mv oc /usr/bin/ && /bin/rm -rf ${OC_VERSION}.tar kubectl README.md
48+
RUN wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable-4.17/${OC_BINARY}.tar.gz && \
49+
gzip -dvf ${OC_BINARY}.tar.gz && tar -xvf ${OC_BINARY}.tar && \
50+
chmod 755 oc && mv oc /usr/bin/ && /bin/rm -rf ${OC_BINARY}.tar kubectl README.md
5351

5452
# Install Python
5553
# https://catalog.redhat.com/software/containers/devspaces/udi-rhel9/673f8460bbf0c33aca0fe316?container-tabs=dockerfile
5654
ENV PYTHON_VERSION="3.13"
5755
RUN dnf -y -q install --setopt=tsflags=nodocs \
5856
python${PYTHON_VERSION} python${PYTHON_VERSION}-devel python${PYTHON_VERSION}-setuptools python${PYTHON_VERSION}-pip python${PYTHON_VERSION}-wheel && \
5957

60-
########################################################################
61-
# Python
62-
########################################################################
6358
python${PYTHON_VERSION} -m pip install --user --no-cache-dir --upgrade pip setuptools pytest flake8 virtualenv yq && \
6459
# python/pip/flake8/yq symlinks
6560
echo "Create python symlinks (or display existing ones) ==>" && \
@@ -99,6 +94,11 @@ RUN dnf -y -q install --setopt=tsflags=nodocs \
9994
echo -n "yq: "; yq --version; \
10095
echo "========"
10196

97+
# Install oc completion
98+
RUN oc completion bash > oc_bash_completion && \
99+
mv oc_bash_completion /etc/bash_completion.d/ && \
100+
cp /etc/skel/.bashrc $USER_HOME_DIR/.bashrc
101+
102102
# A last pass to make sure that an arbitrary user can write in $HOME
103103
RUN chgrp -R 0 /home && chmod -R g=u /home
104104

tools/entrypoint.sh

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -28,56 +28,6 @@ if [ -f "${HOME}"/.venv/bin/activate ]; then
2828
source "${HOME}"/.venv/bin/activate
2929
fi
3030

31-
#############################################################################
32-
# If KUBEDOCK_ENABLED="true" then link podman to /usr/bin/podman-wrapper.sh
33-
# else link podman to /usr/bin/podman.orig
34-
#############################################################################
35-
if [[ "${KUBEDOCK_ENABLED:-false}" == "true" ]]; then
36-
echo
37-
echo "Kubedock is enabled (env variable KUBEDOCK_ENABLED is set to true)."
38-
39-
SECONDS=0
40-
KUBEDOCK_TIMEOUT=${KUBEDOCK_TIMEOUT:-10}
41-
until [ -f $KUBECONFIG ]; do
42-
if (( SECONDS > KUBEDOCK_TIMEOUT )); then
43-
break
44-
fi
45-
echo "Kubeconfig doesn't exist yet. Waiting..."
46-
sleep 1
47-
done
48-
49-
if [ -f $KUBECONFIG ]; then
50-
echo "Kubeconfig found."
51-
52-
KUBEDOCK_PARAMS=${KUBEDOCK_PARAMS:-"--reverse-proxy --kubeconfig $KUBECONFIG"}
53-
54-
echo "Starting kubedock with params \"${KUBEDOCK_PARAMS}\"..."
55-
56-
kubedock server ${KUBEDOCK_PARAMS} > /tmp/kubedock.log 2>&1 &
57-
58-
echo "Done."
59-
60-
echo "Replacing podman with podman-wrapper.sh..."
61-
62-
ln -f -s /usr/bin/podman-wrapper.sh /home/user/.local/bin/podman
63-
64-
export TESTCONTAINERS_RYUK_DISABLED="true"
65-
export TESTCONTAINERS_CHECKS_DISABLE="true"
66-
67-
echo "Done."
68-
echo
69-
else
70-
echo "Could not find Kubeconfig at $KUBECONFIG"
71-
echo "Giving up..."
72-
fi
73-
else
74-
echo
75-
echo "Kubedock is disabled. It can be enabled with the env variable \"KUBEDOCK_ENABLED=true\""
76-
echo "set in the workspace Devfile or in a Kubernetes ConfigMap in the developer namespace."
77-
echo
78-
ln -f -s /usr/bin/podman.orig /home/user/.local/bin/podman
79-
fi
80-
8131
# Configure Podman builds to use vfs or fuse-overlayfs
8232
if [ ! -d "${HOME}/.config/containers" ]; then
8333
mkdir -p ${HOME}/.config/containers
@@ -112,6 +62,6 @@ then
11262
fi
11363

11464
# Login to the local image registry
115-
podman login -u $(oc whoami) -p $(oc whoami -t) image-registry.openshift-image-registry.svc:5000
65+
podman login -u $(oc whoami) -p $(oc whoami -t) image-registry.openshift-image-registry.svc.cluster.local:5000
11666

11767
exec "$@"

tools/kubedock

-61.9 MB
Binary file not shown.

tools/podman-wrapper.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)