Skip to content

Commit 12531a7

Browse files
geroplona-agent
andauthored
Fix SDKMAN_DIR mismatch in Flex environments (#20976)
Install SDKMAN as root (proven working approach) then create gitpod user with symlinks to make SDKMAN accessible at /home/gitpod/.sdkman path expected by JetBrains plugin BUILD.yaml files. This resolves the issue where leeway run dev:preview fails in Flex environments due to SDKMAN path mismatch. Fixes CLC-1619 Co-authored-by: Ona <no-reply@ona.com>
1 parent 266d653 commit 12531a7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ RUN mkdir -p ~/.terraform \
294294

295295
## Java
296296
ENV JAVA_VERSION=11.0.27.fx-zulu
297+
# Install SDKMAN as root first (working approach), then create gitpod user and symlink
297298
RUN curl -fsSL "https://get.sdkman.io" | bash \
298299
&& bash -c ". /root/.sdkman/bin/sdkman-init.sh \
299300
&& sed -i 's/sdkman_selfupdate_enable=true/sdkman_selfupdate_enable=false/g' /root/.sdkman/etc/config \
@@ -308,6 +309,17 @@ RUN curl -fsSL "https://get.sdkman.io" | bash \
308309
&& printf '<settings>\n <localRepository>/workspace/m2-repository/</localRepository>\n</settings>\n' > /root/.m2/settings.xml \
309310
&& echo 'export SDKMAN_DIR=\"/root/.sdkman\"' >> /root/.bashrc.d/99-java \
310311
&& echo '[[ -s \"/root/.sdkman/bin/sdkman-init.sh\" ]] && source \"/root/.sdkman/bin/sdkman-init.sh\"' >> /root/.bashrc.d/99-java"
312+
313+
# Create gitpod user and set up symlinks for SDKMAN compatibility with BUILD.yaml files
314+
RUN useradd -m -s /bin/bash gitpod && \
315+
usermod -aG sudo gitpod && \
316+
echo 'gitpod ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
317+
mkdir -p /home/gitpod/.bashrc.d && \
318+
ln -sf /root/.sdkman /home/gitpod/.sdkman && \
319+
ln -sf /root/.m2 /home/gitpod/.m2 && \
320+
echo 'export SDKMAN_DIR="/home/gitpod/.sdkman"' >> /home/gitpod/.bashrc.d/99-java && \
321+
echo '[[ -s "/home/gitpod/.sdkman/bin/sdkman-init.sh" ]] && source "/home/gitpod/.sdkman/bin/sdkman-init.sh"' >> /home/gitpod/.bashrc.d/99-java
322+
311323
# above, we are adding the sdkman init to .bashrc (executing sdkman-init.sh does that), because one is executed on interactive shells, the other for non-interactive shells (e.g. plugin-host)
312324
ENV GRADLE_USER_HOME=/workspace/.gradle/
313325

0 commit comments

Comments
 (0)