51 lines
2.0 KiB
Docker
51 lines
2.0 KiB
Docker
# JVM stack overlay fragment.
|
|
#
|
|
# Layer this on top of huskies-project-base to produce a project container
|
|
# with OpenJDK 21, Maven, and eclipse.jdt.ls (the canonical Java/JVM LSP).
|
|
#
|
|
# Build the combined image:
|
|
# (echo "FROM huskies-project-base"; \
|
|
# cat docker/stacks/jvm/Dockerfile.fragment) | \
|
|
# docker build -t huskies-project-jvm -
|
|
#
|
|
# Adding a new stack: create docker/stacks/<name>/Dockerfile.fragment and
|
|
# docker/stacks/<name>/markers — no changes to orchestration code required.
|
|
|
|
USER root
|
|
|
|
# OpenJDK 21 (current LTS) and Maven for build support.
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
openjdk-21-jdk-headless \
|
|
maven \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV JAVA_HOME="/usr/lib/jvm/java-21-openjdk-amd64"
|
|
|
|
# Eclipse JDT Language Server — canonical LSP for Java/JVM (Java, Kotlin, Groovy).
|
|
# Pin to a specific release; update JDTLS_VERSION + JDTLS_BUILD for upgrades.
|
|
# All releases: https://github.com/eclipse-jdtls/eclipse.jdt.ls/releases
|
|
ENV JDTLS_VERSION="1.38.0" \
|
|
JDTLS_BUILD="202503271418"
|
|
RUN mkdir -p /opt/jdtls \
|
|
&& curl -fsSL \
|
|
"https://download.eclipse.org/jdtls/milestones/${JDTLS_VERSION}/jdt-language-server-${JDTLS_VERSION}-${JDTLS_BUILD}.tar.gz" \
|
|
| tar -xzf - -C /opt/jdtls
|
|
|
|
# Wrapper script so `jdtls` is available as a PATH command.
|
|
RUN { \
|
|
echo '#!/bin/sh'; \
|
|
echo 'JAR=$(ls /opt/jdtls/plugins/org.eclipse.equinox.launcher_*.jar 2>/dev/null | head -1)'; \
|
|
echo 'exec java \'; \
|
|
echo ' -Declipse.application=org.eclipse.jdt.ls.core.id1 \'; \
|
|
echo ' -Dosgi.bundles.defaultStartLevel=4 \'; \
|
|
echo ' -Declipse.product=org.eclipse.jdt.ls.core.product \'; \
|
|
echo ' -Dlog.protocol=true \'; \
|
|
echo ' -Dlog.level=ALL \'; \
|
|
echo ' -jar "$JAR" \'; \
|
|
echo ' -configuration /opt/jdtls/config_linux \'; \
|
|
echo ' "$@"'; \
|
|
} > /usr/local/bin/jdtls \
|
|
&& chmod +x /usr/local/bin/jdtls
|
|
|
|
USER huskies
|