Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.

Commit 799dfa0

Browse files
committed
Add Dockerfile and update README with Docker instructions
1 parent 385799c commit 799dfa0

File tree

3 files changed

+100
-53
lines changed

3 files changed

+100
-53
lines changed

.github/workflows/release.yml

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,42 @@ jobs:
1010
name: Release
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- name: Checkout code
14+
uses: actions/checkout@v3
1415

15-
- name: Install Rust toolchain
16-
uses: actions-rs/toolchain@v1
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v2
1718
with:
18-
toolchain: stable
19-
override: true
20-
target: x86_64-unknown-linux-gnu
21-
22-
- name: Install cross-compilation tools
23-
run: |
24-
rustup target add x86_64-apple-darwin
25-
rustup target add x86_64-pc-windows-msvc
26-
27-
- name: Build Linux binary
28-
run: cargo build --release --target x86_64-unknown-linux-gnu
29-
30-
- name: Build macOS binary
31-
run: cargo build --release --target x86_64-apple-darwin
32-
33-
- name: Build Windows binary
34-
run: cargo build --release --target x86_64-pc-windows-msvc
35-
36-
- name: Create GitHub Release
37-
uses: softprops/action-gh-release@v1
19+
platforms: 'arm64,amd64'
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v2
23+
24+
- name: Extract metadata (tags, labels) for Docker
25+
id: meta
26+
uses: docker/metadata-action@v4
27+
with:
28+
images: sapientpants/sonarqube-mcp-server
29+
tags: |
30+
type=semver,pattern={{version}}
31+
type=semver,pattern={{major}}.{{minor}}
32+
type=ref,event=branch
33+
type=sha
34+
latest
35+
36+
- name: Login to DockerHub
37+
uses: docker/login-action@v2
38+
with:
39+
username: ${{ secrets.DOCKERHUB_USERNAME }}
40+
password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@v4
3844
with:
39-
files: |
40-
target/x86_64-unknown-linux-gnu/release/sonarqube-mcp-server
41-
target/x86_64-apple-darwin/release/sonarqube-mcp-server
42-
target/x86_64-pc-windows-msvc/release/sonarqube-mcp-server.exe
43-
env:
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
context: .
46+
platforms: linux/amd64,linux/arm64
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Builder stage
2+
FROM rust:1-slim-bookworm as builder
3+
4+
WORKDIR /app
5+
6+
# Install required dependencies for building
7+
RUN apt-get update && \
8+
apt-get install -y --no-install-recommends \
9+
pkg-config \
10+
libssl-dev \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# Copy manifest files first to cache dependencies
14+
COPY Cargo.toml Cargo.lock ./
15+
16+
# Create a dummy src/main.rs to build dependencies
17+
RUN mkdir -p src && \
18+
echo "fn main() {}" > src/main.rs && \
19+
cargo build --release && \
20+
rm -rf src
21+
22+
# Copy the actual source code
23+
COPY src/ src/
24+
25+
# Build the application
26+
RUN cargo build --release
27+
28+
# Runtime stage
29+
FROM debian:bookworm-slim
30+
31+
WORKDIR /app
32+
33+
# Install runtime dependencies
34+
RUN apt-get update && \
35+
apt-get install -y --no-install-recommends \
36+
ca-certificates \
37+
libssl-dev \
38+
&& rm -rf /var/lib/apt/lists/*
39+
40+
# Copy the binary from the builder stage
41+
COPY --from=builder /app/target/release/sonarqube-mcp-server /usr/local/bin/
42+
43+
# Set environment variables (these can be overridden at runtime)
44+
ENV SONARQUBE_URL=https://sonarqube.example.com
45+
ENV SONARQUBE_TOKEN=your-token-here
46+
# ENV SONARQUBE_ORGANIZATION=your-organization
47+
# ENV SONARQUBE_DEBUG=false
48+
49+
# Expose port if needed (adjust based on your application)
50+
# EXPOSE 8080
51+
52+
# Run the MCP server
53+
ENTRYPOINT ["sonarqube-mcp-server", "--mcp"]

README.md

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,6 @@ The SonarQube MCP Server enables AI assistants to interact with SonarQube's code
4242

4343
Download the pre-built binary for your platform from the [Releases](https://github.com/yourusername/sonarqube-mcp-server/releases) page.
4444

45-
## Usage
46-
47-
### CLI Options
48-
49-
* `--mcp`: Enable MCP server mode
50-
* `--resources`: Display available resources
51-
* `--prompts`: Display available prompts
52-
* `--tools`: Display available tools
53-
* `--help`: Show help information
54-
55-
### Configuration
56-
57-
The SonarQube MCP Server requires the following environment variables:
58-
59-
* `SONARQUBE_URL`: The base URL of your SonarQube server (e.g., `https://sonarqube.example.com`)
60-
* `SONARQUBE_TOKEN`: Your SonarQube authentication token
61-
62-
Optional environment variables:
63-
64-
* `SONARQUBE_ORGANIZATION`: Organization key for SonarCloud or multi-organization SonarQube instances
65-
* `SONARQUBE_DEBUG`: Set to "1" or "true" to enable detailed debugging output
66-
6745
### Integration with Claude Desktop
6846

6947
1. Edit `claude_desktop_config.json`: Claude Desktop -> `Settings` -> `Developer` -> `Edit Config`
@@ -73,9 +51,18 @@ Optional environment variables:
7351
{
7452
"mcpServers": {
7553
"sonarqube": {
76-
"command": "sonarqube-mcp-server",
54+
"command": "docker",
7755
"args": [
78-
"--mcp"
56+
"run",
57+
"-i",
58+
"--rm",
59+
"-e",
60+
"SONARQUBE_URL",
61+
"-e",
62+
"SONARQUBE_TOKEN",
63+
"-e",
64+
"SONARQUBE_ORGANIZATION",
65+
"sapientpants/sonarqube-mcp-server"
7966
],
8067
"env": {
8168
"SONARQUBE_URL": "https://sonarqube.example.com",

0 commit comments

Comments
 (0)