Update Dockerfile and entrypoint for enhanced development tools and configuration

Update Dockerfile to include clangd, replace npm packages with pyright and typescript-language-server, add GOPATH and GOBIN environment variables, and improve user creation. Update docker-entrypoint.sh to export environment variables, configure opencode.json, and set up MCP language server with proper configuration files.
This commit is contained in:
2026-02-21 16:42:44 +01:00
parent f984f5f062
commit ea29352f7a
5 changed files with 108 additions and 49 deletions

View File

@@ -1,7 +1,7 @@
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
clang llvm-dev libclang-dev pkg-config build-essential git make curl nodejs npm \
clang clangd llvm-dev libclang-dev pkg-config build-essential git make curl nodejs npm \
pylint black flake8 mypy isort logrotate sudo cmake libicu-dev zlib1g-dev \
libcurl4-openssl-dev libssl-dev ruby-dev jq python3 python3-pip golang-go rustc cargo \
r-base sqlite3 wget bash zsh libgit2-dev \
@@ -22,7 +22,7 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable && \
rustup component add rustfmt clippy rust-src rust-docs && \
cargo install cargo-edit cargo-watch cargo-outdated cargo-make cargo-binstall
RUN npm install -g typescript tsc @types/node eslint prettier
RUN npm install -g typescript tsc @types/node eslint prettier pyright typescript-language-server
RUN cargo binstall --strategies crate-meta-data jj-cli
@@ -36,17 +36,19 @@ RUN curl -fsSL https://opencode.ai/install | bash && \
mkdir -p /root/.config/opencode && \
mv /root/.opencode/bin/opencode /usr/local/bin/
COPY opt/bin/ /opt/bin/
COPY opt/dev-tools/ /opt/dev-tools/
COPY opt/lm-client/ /opt/lm-client/
ENV PATH="/opt/bin:/opt/dev-tools:/opt/lm-client:${PATH}"
ENV GOPATH=/usr/local/go
ENV GOBIN=/usr/local/go/bin
RUN go install golang.org/x/tools/gopls@latest
RUN go install github.com/isaacphi/mcp-language-server@latest
ARG USERNAME=devuser
ARG USER_UID=1000
ARG USER_GID=1000
RUN groupadd --gid $USER_GID $USERNAME && \
useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
useradd --uid $USER_UID \
--gid $USER_GID \
-m $USERNAME \
--shell /bin/bash
COPY docker-entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

View File

@@ -1,6 +1,17 @@
#!/bin/bash
# docker-entrypoint.sh
export USERNAME=${USERNAME:-devuser}
export LOCAL_LLM_API=${LOCAL_LLM_API:-http://host.docker.internal:1248/v1}
export MAXTOKEN=${MAXTOKEN:-4096}
export NUM_CTX=${NUM_CTX:-32768}
export REPEAT_PENALTY=${REPEAT_PENALTY:-1.3}
export TEMPERATURE=${TEMPERATURE:-0.5}
export TOP_P=${TOP_P:-0.95}
export TOP_K=${TOP_K:-40}
export STOP=${STOP:-"[\"</s>\", \"\\n\\n\", \"def \", \"class \"]"}
# --- Initialise .ai_index si nécessaire ---
if [ ! -d "/workspace/.ai_index" ]; then
mkdir -p /workspace/.ai_index/ast
@@ -10,17 +21,98 @@ fi
# --- Configure LOCAL_LLM_API pour Bash ---
if [ -n "$LOCAL_LLM_API" ]; then
if ! grep -q "LOCAL_LLM_API" /home/devuser/.bashrc; then
echo "export LOCAL_LLM_API=$LOCAL_LLM_API" >> /home/devuser/.bashrc
if ! grep -q "LOCAL_LLM_API" /home/${USERNAME}/.bashrc; then
echo "export LOCAL_LLM_API=$LOCAL_LLM_API" >> /home/${USERNAME}/.bashrc
fi
mkdir -p /home/${USERNAME}/.config/opencode
CONFIG_FILE=/home/${USERNAME}/.config/opencode/opencode.json
cat > $CONFIG_FILE <<EOF
{
"\$schema": "https://opencode.ai/config.json",
"provider": {
"lmstudio": {
"npm": "@ai-sdk/openai-compatible",
"name": "LM Studio (local)",
"options": {
"baseURL": "$LOCAL_LLM_API",
"apiKey": ""
},
"models": {
"qwen/qwen3-coder-next@4bit": {
"name": "Qwen 3 Coder Next 80B — (LLMStudio ; 4-bit)",
"limit": {
"context": 200000,
"output": 65536
},
"settings": {
"temperature": $TEMPERATURE,
"top_p": $TOP_P,
"top_k": $TOP_K,
"max_tokens": ${MAXTOKEN},
"num_ctx": ${NUM_CTX},
"repeat_penalty": ${REPEAT_PENALTY},
"stop": ${STOP}
}
},
"qwen/qwen3-coder-next@6bit": {
"name": "Qwen 3 Coder Next 80B — (LLMStudio ; 6-bit)",
"limit": {
"context": 200000,
"output": 65536
},
"settings": {
"temperature": $TEMPERATURE,
"top_p": $TOP_P,
"top_k": $TOP_K,
"max_tokens": ${MAXTOKEN},
"num_ctx": ${NUM_CTX},
"repeat_penalty": ${REPEAT_PENALTY},
"stop": ${STOP}
}
}
}
}
},
"model": "lmstudio/qwen/qwen3-coder-next@4bit"
}
EOF
chown ${USERNAME}:${USERNAME} ${CONFIG_FILE}
fi
# --- Lance MCP server en background si pas déjà lancé ---
if [ ! -f "/workspace/.ai_index/mcp.pid" ] || ! kill -0 $(cat /workspace/.ai_index/mcp.pid) 2>/dev/null; then
/opt/bin/mcp-server >/workspace/.ai_index/mcp.log 2>&1 &
echo $! >/workspace/.ai_index/mcp.pid
# --- Install MCP Language Server ---
if command -v mcp-language-server &> /dev/null; then
mkdir -p /home/${USERNAME}/.config/opencode
MCP_CONFIG=/home/${USERNAME}/.config/opencode/mcp_servers.json
cat > $MCP_CONFIG <<EOF
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": [
"--workspace",
"/workspace",
"--lsp",
"gopls"
],
"env": {
"PATH": "/usr/local/go/bin:/usr/local/cargo/bin:/usr/local/bin:$PATH",
"GOPATH": "/home/${USERNAME}/go",
"GOCACHE": "/home/${USERNAME}/.cache/go-build",
"GOMODCACHE": "/home/${USERNAME}/go/pkg/mod"
}
}
}
}
EOF
chown ${USERNAME}:${USERNAME} $MCP_CONFIG
fi
# --- Force Bash comme shell par défaut ---
if [ -z "$1" ]; then
exec /bin/bash

View File

@@ -1,5 +0,0 @@
#!/bin/bash
echo "[MCP] Starting..." >> /workspace/.ai_index/mcp.log
python3 /opt/dev-tools/list_imports.py "$@" >> /workspace/.ai_index/mcp.log 2>&1 &
echo $! > /workspace/.ai_index/mcp.pid
wait

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env python3
import sys, json
def get_imports_go(filepath: str) -> list[str]:
try:
with open(filepath) as f:
lines = f.readlines()
imports = []
in_import_block = False
for line in lines:
stripped = line.strip()
if stripped == "import (":
in_import_block = True
continue
if stripped == ")" and in_import_block:
break
if in_import_block and stripped.startswith('"'):
imports.append(stripped.strip('"'))
return imports
except Exception as e:
return [f"error: {e}"]
if __name__ == "__main__":
args = json.loads(sys.argv[1])
filepath = args.get("file", "")
result = get_imports_go(filepath)
print(json.dumps({"result": result}, indent=2))

View File

@@ -1,3 +0,0 @@
Local LLM API client for Qwen3-Coder-Next
Download from: https://lmstudio.ai/
Configure to run on http://host.docker.internal:1248/v1 (or set LOCAL_LLM_API environment variable)