Moved back to debian base image; moved docker support scripts; updated language server java entry to not be appimage aligned in arg format

This commit is contained in:
2025-11-26 00:31:15 -06:00
parent 4c2a3b6fe7
commit 51a0c4a677
7 changed files with 158 additions and 65 deletions

View File

@@ -1,19 +1,34 @@
# 1. A: Define a base image # 1. A: Define a base image
# FROM python:3.12 # FROM scratch
# FROM busybox
# FROM alpine:3.22.1 # FROM alpine:3.22.1
FROM alpine:latest # FROM alpine:latest
# FROM debian:bookworm-slim # FROM python:3.12
FROM debian:bookworm-slim
# 1. B: Set ENV Variables # 1. B: Set ENV Variables
ENV PYTHON_VERSION=3.12 ENV NVM_VERSION=0.40.3
ENV JAVA_VERSION=22.0.2 ENV NODE_VERSION=24.9.0
ENV PYTHON_VERSION=3.12.12
ENV NVM_DIR="/root/.nvm"
ENV PYENV_ROOT="/opt/pyenv"
ENV JEXTRACT_PATH="/opt/jextract"
ENV JAVA_LS_PATH="/opt/java-language-server"
ENV JDTLS_PATH="/opt/jdtls"
ENV MAVEN_PATH="/opt/maven"
ENV JAVA_HOME="/opt/jdk"
ENV PATH="${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}"
ENV PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"
ENV PATH="${JEXTRACT_PATH}/bin:${PATH}"
ENV PATH="${JAVA_LS_PATH}/:${PATH}"
ENV PATH="${JDTLS_PATH}/bin:${PATH}"
ENV PATH="${MAVEN_PATH}/bin:${PATH}"
ENV PATH="${JAVA_HOME}/bin:${PATH}"
ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
ENV PYENV_ROOT="/opt/pyenv"
ENV PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"
# 2. Set the working directory inside the container # 2. Set the working directory inside the container
WORKDIR /app WORKDIR /app
@@ -22,73 +37,67 @@ WORKDIR /app
COPY requirements.txt . COPY requirements.txt .
COPY package.json . COPY package.json .
COPY src/* . COPY src/* .
COPY Docker/scripts/run.sh .
COPY Docker/opt/ /opt/
# 4. A: Install dependencies # 4. A: Install dependencies
# RUN apt update # RUN apt update
# RUN apt install -y pkg-config curl clang gopls git libgirepository1.0-dev libssl-dev libcairo2-dev # RUN apt install
RUN apt-get update
RUN apk update RUN apt-get install \
RUN apk add --no-cache \ --no-install-recommends \
nodejs \ --no-install-suggests \
npm \ -y \
bash \ pkg-config \
bash-completion \ ca-certificates \
libreadline-dev \
liblzma-dev \
libsqlite3-dev \
libncurses5-dev \
libncursesw5-dev \
libgirepository1.0-dev \
libssl-dev libcairo2-dev \
curl \ curl \
clang \ clang \
pkgconf \
make \
git \
gopls \ gopls \
linux-headers \ git
build-base \
openssh \ # RUN apk update
tzdata \ # RUN apk add --no-cache \
openssl-dev \ # nodejs \
bzip2-dev \ # npm \
zlib-dev \ # bash \
xz-dev \ # bash-completion \
sqlite-dev \ # curl \
readline-dev \ # clang \
libffi-dev \ # pkgconf \
gdbm-dev \ # make \
gobject-introspection-dev \ # git \
cairo-dev # gopls \
# gobject-introspection-dev \
# cairo-dev
RUN curl -fsSL https://pyenv.run | bash RUN curl -fsSL https://pyenv.run | bash
RUN pyenv install ${PYTHON_VERSION} && pyenv global ${PYTHON_VERSION} && pyenv local ${PYTHON_VERSION} RUN pyenv install ${PYTHON_VERSION} && pyenv global ${PYTHON_VERSION} && pyenv local ${PYTHON_VERSION}
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# 4. B: Install nvm and node # # 4. B: Install nvm and node
# RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v"${NVM_VERSION}"/install.sh | bash
# RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} RUN . "${NVM_DIR}/nvm.sh" && nvm install ${NODE_VERSION}
# RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} RUN . "${NVM_DIR}/nvm.sh" && nvm use v${NODE_VERSION}
# RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION} RUN . "${NVM_DIR}/nvm.sh" && nvm alias default v${NODE_VERSION}
RUN npm install
RUN node --version RUN node --version
RUN npm --version RUN npm --version
RUN npm install RUN java --version
# 5. A: Remove dependencies
RUN apk del \
linux-headers \
build-base \
openssh \
tzdata \
openssl-dev \
bzip2-dev \
zlib-dev \
xz-dev \
sqlite-dev \
readline-dev \
libffi-dev \
gdbm-dev \
gobject-introspection-dev \
cairo-dev
# # 5. Cleanup
RUN rm -rf /tmp/* RUN rm -rf /tmp/*
RUN rm -rf /opt/nvm/.cache RUN rm -rf "${NVM_DIR}/.cache"
RUN rm /app/requirements.txt RUN rm /app/requirements.txt
# 6. Expose Port and define the command used to run the app # 6. Expose Port and define the command used to run the app
EXPOSE 9999 EXPOSE 9999
CMD ["npm", "run", "start-verbose"] CMD ["/app/run.sh"]

26
Docker/scripts/clean.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
# . CONFIG.sh
# set -o xtrace ## To debug scripts
# set -o errexit ## To exit on error
# set -o errunset ## To exit if a variable is referenced but not set
function main() {
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
cd "${SCRIPTPATH}"
echo "Working Dir: " $(pwd)
podman container prune
podman image prune
podman volume prune
podman network prune
podman machine stop
podman machine reset
podman machine init
podman machine start
}
main $@;

View File

@@ -13,12 +13,11 @@ function main() {
echo "Working Dir: " $(pwd) echo "Working Dir: " $(pwd)
ID=$(podman ps --filter "ancestor=localhost/newton-lsp:latest" --format "{{.ID}}") ID=$(podman ps --filter "ancestor=localhost/newton-lsp:latest" --format "{{.ID}}")
if [ "${ID}" != "" ]; then if [ "${ID}" == "" ]; then
echo "Is up..." echo "Is not up..."
exit 1 exit 1
fi fi
podman run -p 9999:9999 newton-lsp:latest podman exec -it "${ID}" /bin/sh
} }
main $@; main $@;

28
Docker/scripts/run.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# . CONFIG.sh
# set -o xtrace ## To debug scripts
# set -o errexit ## To exit on error
# set -o errunset ## To exit if a variable is referenced but not set
function main() {
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
cd "${SCRIPTPATH}"
echo "Working Dir: " $(pwd)
# Setup config paths and copy needed files over.
mkdir temp
mkdir -p "${JDTLS_DATA_PATH}"
mkdir -p "${JDTLS_CONFIG_PATH}/m2/logging"
mkdir -p "${JDTLS_CONFIG_PATH}/m2/repository"
mkdir -p "${JDTLS_CONFIG_PATH}/m2/conf/logging"
mkdir -p "${JDTLS_CONFIG_PATH}/m2/lib/ext"
cp -r "${MAVEN_PATH}/conf/settings.xml" "${JDTLS_CONFIG_PATH}"
cp -r "${JDTLS_PATH}/config_linux" "${JDTLS_CONFIG_PATH}"
npm run start-verbose
}
main $@;

31
Docker/scripts/start.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
# . CONFIG.sh
# set -o xtrace ## To debug scripts
# set -o errexit ## To exit on error
# set -o errunset ## To exit if a variable is referenced but not set
function main() {
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
cd "${SCRIPTPATH}"
echo "Working Dir: " $(pwd)
ID=$(podman ps --filter "ancestor=localhost/newton-lsp:latest" --format "{{.ID}}")
if [ "${ID}" != "" ]; then
echo "Is up..."
exit 1
fi
podman run \
-p 9999:9999 \
-e HOME="${HOME}" \
-e MAVEN_OPTS="-Duser.home=${HOME}" \
-e JAVA_TOOL_OPTIONS="-Duser.home=${HOME}" \
-e JDTLS_CONFIG_PATH="${HOME}/.config/lsps/jdtls" \
-e JDTLS_DATA_PATH="${JDTLS_CONFIG_PATH}/data" \
-v "${HOME}":"${HOME}" \
newton-lsp:latest
}
main $@;

View File

@@ -48,14 +48,14 @@ exports.servers = [
}, { }, {
endpointName: "java", endpointName: "java",
args: [ args: [
'javals', ["jdtls"] "jdtls"
], ],
nameEndsWith: ".java", nameEndsWith: ".java",
connectionType: "stdio" connectionType: "stdio"
}, { }, {
endpointName: "java-other", endpointName: "java-other",
args: [ args: [
'javals', ["java-language-server"] "java-language-server"
], ],
nameEndsWith: ".java", nameEndsWith: ".java",
connectionType: "stdio" connectionType: "stdio"