Docker move to alpine; moved sub README to servers

This commit is contained in:
2025-11-25 16:30:45 -06:00
parent cc41036174
commit 15fdb43193
4 changed files with 85 additions and 16 deletions

View File

@@ -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"]

View File

@@ -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

View File

@@ -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 $@;

View File

@@ -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}"
}