Skip to content

Commit 11fb2be

Browse files
committed
docs(container): add README explaining server container configuration and registry
1 parent 550ee7d commit 11fb2be

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

container/README.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Container Registry
2+
3+
This directory contains Docker container configurations for LSP servers and a registry system for managing server versions.
4+
5+
## Directory Structure
6+
7+
```
8+
container/
9+
├── registry.toml # Server registry configuration
10+
├── registry.schema.json # JSON schema for registry validation
11+
└── <server-name>/ # Individual server configurations
12+
└── ContainerFile # Docker container build instructions
13+
```
14+
15+
## Adding a New LSP Server
16+
17+
To add a new LSP server, you need to:
18+
19+
1. Create a directory for the server
20+
2. Create a `ContainerFile` with build instructions
21+
3. Register the server in `registry.toml`
22+
23+
### Step 1: Create Server Directory and ContainerFile
24+
25+
Create a new directory with the server name and add a `ContainerFile`:
26+
27+
```dockerfile
28+
# Example ContainerFile for a Node.js based LSP server
29+
ARG VERSION=1.0.0
30+
FROM node:22-slim AS builder
31+
ARG VERSION
32+
RUN npm install -g <package-name>@${VERSION}
33+
34+
FROM node:22-slim
35+
ARG VERSION
36+
LABEL org.opencontainers.image.version="${VERSION}"
37+
COPY --from=builder /usr/local/lib/node_modules /usr/local/lib/node_modules
38+
COPY --from=builder /usr/local/bin/<binary-name> /usr/local/bin/<binary-name>
39+
40+
WORKDIR /workspace
41+
ENTRYPOINT ["<binary-name>", "--stdio"]
42+
```
43+
44+
**Key points:**
45+
- Use multi-stage builds to minimize final image size
46+
- Define `ARG VERSION` for version management
47+
- Set appropriate labels for metadata
48+
- Use `--stdio` for LSP protocol communication
49+
- Ensure the ENTRYPOINT runs the language server
50+
51+
### Step 2: Register in Registry
52+
53+
Add an entry to `registry.toml`:
54+
55+
```toml
56+
[server-name]
57+
type = "npm" # or "pypi", "github", "custom"
58+
package = "package-name" # for npm/pypi
59+
repo = "owner/repo" # for github
60+
strip_v = true # optional, remove 'v' prefix from github releases
61+
```
62+
63+
#### Registry Types
64+
65+
**npm**: For Node.js packages
66+
```toml
67+
[typescript]
68+
type = "npm"
69+
package = "typescript-language-server"
70+
```
71+
72+
**pypi**: For Python packages
73+
```toml
74+
[pyrefly]
75+
type = "pypi"
76+
package = "pyrefly"
77+
```
78+
79+
**github**: For GitHub releases
80+
```toml
81+
[rust-analyzer]
82+
type = "github"
83+
repo = "rust-lang/rust-analyzer"
84+
85+
[deno]
86+
type = "github"
87+
repo = "denoland/deno"
88+
strip_v = true # Remove 'v' prefix from version tags
89+
```
90+
91+
**custom**: For custom version checking commands
92+
```toml
93+
[custom-server]
94+
type = "custom"
95+
command = "curl -s https://api.example.com/version | jq -r .version"
96+
```
97+
98+
### Step 3: Build and Test
99+
100+
The CI system will automatically:
101+
1. Check for new versions using the registry configuration
102+
2. Build containers when versions change
103+
3. Push images to the registry
104+
105+
To manually test:
106+
```bash
107+
# Build container
108+
docker build -f container/<server-name>/ContainerFile -t lsp/<server-name>:latest .
109+
110+
# Test the container
111+
docker run --rm lsp/<server-name>:latest --version
112+
```
113+
114+
## Version Management
115+
116+
Versions are automatically updated via the `update_containers.yml` GitHub workflow:
117+
118+
1. `scripts/server_versions.py` reads `registry.toml` and fetches latest versions
119+
2. Updates `ContainerFile` ARG VERSION values
120+
3. Builds and pushes new container images
121+
4. Commits version updates back to the repository
122+
123+
The workflow runs weekly or can be triggered manually with the "force" option.

0 commit comments

Comments
 (0)