-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.maximal
More file actions
95 lines (81 loc) · 3.32 KB
/
Copy pathDockerfile.maximal
File metadata and controls
95 lines (81 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# syntax=docker/dockerfile:1.6
# CodeLens — maximal Docker image (Phase 2, issue #54)
#
# @WHO: Dockerfile.maximal
# @WHAT: Maximal container image — core + all Python extras + pre-installed LSP servers (Python, JS/TS)
# @PART: distribution
# @ENTRY: codelens (wrapper -> python3 /opt/codelens/scripts/codelens.py)
#
# Build:
# docker build -t codelens:maximal -f Dockerfile.maximal .
#
# Run:
# docker run --rm -v "$(pwd):/workspace" ghcr.io/wolfvin/codelens:maximal-latest scan /workspace
#
# Differences vs minimal Dockerfile:
# - Installs all Python extras (grammars + watch + rules + lsp + dev)
# - Pre-installs LSP servers for Python (python-lsp-server, ruff-lsp) and
# JS/TS (typescript-language-server, pyright) so `--deep` works out of the box
# - Includes Node.js LTS (required by the npm-based LSP servers above)
#
# Note: full LSP coverage (Rust analyzer, Go gopls, etc.) is pending the native
# LSP server issue referenced in #54. This image covers the two most common
# languages (Python, JS/TS) and is extensible.
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION}-slim AS base
LABEL org.opencontainers.image.title="CodeLens (maximal)" \
org.opencontainers.image.description="CodeLens CLI + MCP server with all extras and pre-installed LSP servers" \
org.opencontainers.image.source="https://github.com/Wolfvin/CodeLens" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.authors="Wolfvin"
# Runtime deps: git (ownership/diff commands), ca-certificates, curl.
# Node.js + npm: required by typescript-language-server and pyright (JS/TS LSP).
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
ca-certificates \
curl \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd --gid 1000 codelens \
&& useradd --uid 1000 --gid codelens --create-home --shell /bin/bash codelens
COPY --chown=codelens:codelens . /opt/codelens/
# Install ALL Python extras matching pyproject.toml [project.optional-dependencies]
# all = [grammars, watch, rules, lsp, dev]. Plus pip-based LSP servers for Python.
RUN pip install --no-cache-dir \
"tree-sitter>=0.21.0" \
tree-sitter-html \
tree-sitter-css \
tree-sitter-javascript \
tree-sitter-typescript \
tree-sitter-rust \
tree-sitter-python \
watchdog \
"PyYAML>=6.0" \
"pygls>=2.0" \
"lsprotocol>=2024.0" \
"pytest>=7.0" \
"pytest-cov" \
"python-lsp-server[all]" \
"ruff-lsp"
# Install JS/TS LSP servers globally via npm.
RUN npm install -g --no-save \
pyright \
typescript-language-server \
&& npm cache clean --force 2>/dev/null || true
# Wrapper script (same as minimal — see Dockerfile for forward-compat notes).
RUN printf '#!/bin/sh\nexec python3 /opt/codelens/scripts/codelens.py "$@"\n' \
> /usr/local/bin/codelens \
&& chmod +x /usr/local/bin/codelens
RUN mkdir -p /workspace \
&& chown codelens:codelens /workspace
USER codelens
WORKDIR /workspace
ENV CODELENS_CONFIG_DIR=/home/codelens/.codelens \
PYTHONUNBUFFERED=1 \
PYTHONUTF8=1 \
PYTHONDONTWRITEBYTECODE=1
HEALTHCHECK --interval=30s --timeout=30s --start-period=15s --retries=3 \
CMD codelens --command-count > /dev/null 2>&1 || exit 1
ENTRYPOINT ["codelens"]