Skip to content

Commit ca563ff

Browse files
authored
UBI9 support (#33)
Signed-off-by: Artem Zatsarynnyi <[email protected]>
1 parent 00fea16 commit ca563ff

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

build/dockerfiles/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ USER 0
2525

2626
COPY --chmod=755 /build/scripts/*.sh /
2727
COPY /status-app/ /status-app/
28-
# Copy the JetBrains IDE's config where some settings are overridden for Che CDE needs.
29-
COPY /build/jetbrains_configs/idea.properties/ /
3028

3129
# Create a folder structure for mounting a shared volume and copy the editor binaries.
3230
RUN mkdir -p /idea-server/status-app
@@ -41,7 +39,11 @@ RUN for f in "${HOME}" "/etc/passwd" "/etc/group" "/status-app" "/idea-server";
4139
WORKDIR /status-app/
4240
RUN npm install
4341

44-
# to provide to a UBI8-based user's container
42+
# When registry.access.redhat.com/ubi9 is used as a user container,
43+
# there no libbrotli in the image. We provide it additionally to the user's container.
44+
RUN mkdir /node-ubi9-ld_libs && cp -r /usr/lib64/libbrotli* /node-ubi9-ld_libs/
45+
46+
# To make the solution backward compatible with the UBI8-based user containers.
4547
COPY --from=ubi8 /usr/bin/node /node-ubi8
4648

4749
# Switch to an unprivileged user.

build/jetbrains_configs/idea.properties

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

build/scripts/entrypoint-init-container.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if [ -z "$ide_flavour" ]; then
2424
fi
2525

2626
# Download the IDE binaries and install them to the shared volume.
27-
cd "$ide_server_path"
27+
cd "$ide_server_path" || exit
2828
echo "Downloading IDE binaries..."
2929
# After updating the versions here, update the editor definitions in https://github.com/eclipse-che/che-operator/tree/main/editors-definitions
3030
ide_download_url=""
@@ -63,13 +63,11 @@ curl -sL "$ide_download_url" | tar xzf - --strip-components=1
6363
cp -r /status-app/ "$ide_server_path"
6464
cp /entrypoint-volume.sh "$ide_server_path"
6565

66-
# Copy the Che-specific JetBrains IDE's config to the volume.
67-
cp /idea.properties "$ide_server_path"
68-
6966
# Copy Node.js binaries to the editor volume.
7067
# It will be copied to the user container if it's absent.
7168
cp /usr/bin/node "$ide_server_path"/node-ubi9
7269
cp /node-ubi8 "$ide_server_path"/node-ubi8
70+
cp -r /node-ubi9-ld_libs "$ide_server_path"/node-ubi9-ld_libs
7371

7472
echo "Volume content:"
7573
ls -la "$ide_server_path"

build/scripts/entrypoint-volume.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ get_openssl_version() {
8181

8282
# Start the app that checks the IDE server status.
8383
# This will be workspace's 'main' endpoint.
84-
cd "$ide_server_path"/status-app
84+
cd "$ide_server_path"/status-app || exit
8585
if command -v npm &> /dev/null; then
8686
# Node.js installed in a user's container
8787
nohup npm start &
@@ -97,6 +97,10 @@ else
9797
;;
9898
*"3"*)
9999
mv "$ide_server_path"/node-ubi9 "$ide_server_path"/node
100+
101+
# When registry.access.redhat.com/ubi9 is used as a user container,
102+
# there no libbrotli in the image. We provide it additionally.
103+
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ide_server_path/node-ubi9-ld_libs"
100104
;;
101105
*)
102106
echo "[WARNING] Unsupported OpenSSL major version. Node.js from UBI9 will be used."
@@ -107,8 +111,16 @@ else
107111
nohup "$ide_server_path"/node index.js &
108112
fi
109113

110-
# Override the default JetBrains IDE's config by our own.
111-
mv "$ide_server_path"/idea.properties "${HOME}/idea.properties"
114+
cd "$ide_server_path"/bin || exit
115+
116+
# remote-dev-server.sh writes to several sub-folders of HOME (.config, .cache, etc.)
117+
# When registry.access.redhat.com/ubi9 is used for running a user container, HOME=/ which is read-only.
118+
# In this case, we point remote-dev-server.sh to a writable HOME.
112119

113-
cd "$ide_server_path"/bin
114-
./remote-dev-server.sh run ${PROJECT_SOURCE}
120+
if [ -w "$HOME" ]; then
121+
./remote-dev-server.sh run "$PROJECT_SOURCE"
122+
else
123+
echo "No write permission to HOME=$HOME. IDE dev server will be launched with HOME=/tmp/user"
124+
mkdir /tmp/user
125+
env HOME=/tmp/user ./remote-dev-server.sh run "$PROJECT_SOURCE"
126+
fi

0 commit comments

Comments
 (0)