From 15fdb431932bccb1565691469f482093f9e30b20 Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Tue, 25 Nov 2025 16:30:45 -0600 Subject: [PATCH] Docker move to alpine; moved sub README to servers --- Docker/Dockerfile | 84 ++++++++++++++++++++++++++++------ Docker/{ => servers}/README.md | 6 +-- Docker/start.sh | 6 +++ Docker/stop.sh | 5 ++ 4 files changed, 85 insertions(+), 16 deletions(-) rename Docker/{ => servers}/README.md (95%) diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 3788dc6..093a91c 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -1,13 +1,19 @@ -# 1. A: Use an existing Python image -FROM python:3.12 +# 1. A: Define a base image +# FROM python:3.12 +# FROM alpine:3.22.1 +FROM alpine:latest +# FROM debian:bookworm-slim # 1. B: Set ENV Variables +ENV PYTHON_VERSION=3.12 +ENV JAVA_VERSION=22.0.2 + ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 +ENV PYENV_ROOT="/opt/pyenv" + +ENV PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}" -ENV NODE_VERSION=24.9.0 -ENV NVM_DIR=/root/.nvm -ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}" # 2. Set the working directory inside the container WORKDIR /app @@ -17,20 +23,72 @@ COPY requirements.txt . COPY package.json . COPY src/* . -# 4. A: Install the dependencies -RUN apt update -RUN apt install -y curl libgirepository1.0-dev +# 4. A: Install dependencies +# RUN apt update +# RUN apt install -y pkg-config curl clang gopls git libgirepository1.0-dev libssl-dev libcairo2-dev + +RUN apk update +RUN apk add --no-cache \ + nodejs \ + npm \ + bash \ + bash-completion \ + curl \ + clang \ + pkgconf \ + make \ + git \ + gopls \ + 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 + +RUN curl -fsSL https://pyenv.run | bash +RUN pyenv install ${PYTHON_VERSION} && pyenv global ${PYTHON_VERSION} && pyenv local ${PYTHON_VERSION} RUN pip install --no-cache-dir -r requirements.txt # 4. B: Install nvm and node -RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash -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 alias default v${NODE_VERSION} +# RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash +# 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 alias default v${NODE_VERSION} + RUN node --version RUN npm --version RUN npm install -# 5. Expose Port and define the command used to run the app +# 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 + +RUN rm -rf /tmp/* +RUN rm -rf /opt/nvm/.cache +RUN rm /app/requirements.txt + +# 6. Expose Port and define the command used to run the app EXPOSE 9999 CMD ["npm", "run", "start-verbose"] \ No newline at end of file diff --git a/Docker/README.md b/Docker/servers/README.md similarity index 95% rename from Docker/README.md rename to Docker/servers/README.md index c2e32b9..5f9f9af 100644 --- a/Docker/README.md +++ b/Docker/servers/README.md @@ -2,13 +2,13 @@ **Dockerfiles for Language Server Protocol (LSP) servers** - Containerized language servers for use with IDEs. +## Note: +Files under here were copied from https://github.com/lspcontainers/dockerfiles/servers. This README is modified from the repo as well. + ## What is this? This sub repository provides **production-ready Docker containers** for 25+ Language Server Protocol (LSP) servers. -## Note: -Files under servers/ were copied from https://github.com/lspcontainers/dockerfiles/servers. The root dockerfile is primary and not part of the reference servers. This README is modified from the other repo. - ### **How it works:** 1. **Docker containers** provide isolated, reproducible LSP server environments 3. **Zero local installation** - no need to install language servers on your system diff --git a/Docker/start.sh b/Docker/start.sh index ea147be..4a3419a 100755 --- a/Docker/start.sh +++ b/Docker/start.sh @@ -12,6 +12,12 @@ function main() { 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 newton-lsp:latest } main $@; diff --git a/Docker/stop.sh b/Docker/stop.sh index 38b81b4..2ec6c42 100755 --- a/Docker/stop.sh +++ b/Docker/stop.sh @@ -11,7 +11,12 @@ 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 not up..." + exit 1 + fi podman container stop "${ID}" }