Skip to content

Commit d5a872a

Browse files
authored
Merge pull request #2 from KenosInc/add-dockerfile-ci
Add Dockerfile, CI workflow, and Dependabot config
2 parents 8b05780 + 3196a30 commit d5a872a

File tree

7 files changed

+137
-4
lines changed

7 files changed

+137
-4
lines changed

.devcontainer/devcontainer.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
1212
"ghcr.io/devcontainers/features/node:1": {
1313
"version": "lts"
14-
}
14+
},
15+
"ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {}
16+
},
17+
"remoteEnv": {
18+
"PATH": "${containerEnv:HOME}/.local/bin:${containerEnv:PATH}"
1519
},
1620
"customizations": {
1721
"vscode": {
@@ -44,6 +48,5 @@
4448
}
4549
},
4650
"remoteUser": "vscode",
47-
"postCreateCommand": "npm install -g markdownlint-cli2 && markdownlint-cli2 --version && echo 'Dev container ready!'",
48-
"postStartCommand": "test -w /go/pkg/mod || echo 'WARNING: Go module cache is not writable. Run: docker volume rm sigrok-mcp-server-go-mod-cache and rebuild the container.'"
49-
}
51+
"postCreateCommand": "bash .devcontainer/post-create.sh"
52+
}

.devcontainer/post-create.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Install global npm tools
5+
npm install -g markdownlint-cli2
6+
7+
# Verify all tools are available
8+
echo "--- Tool verification ---"
9+
sigrok-cli --version
10+
yamllint --version
11+
golangci-lint version
12+
gh --version
13+
node --version
14+
markdownlint-cli2 --version
15+
16+
# Check Go module cache volume permissions
17+
if [ ! -w /go/pkg/mod ]; then
18+
echo "WARNING: Go module cache is not writable. Run: docker volume rm sigrok-mcp-server-go-mod-cache and rebuild the container."
19+
fi
20+
21+
echo "Dev container ready!"

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
commit-message:
8+
prefix: "deps"
9+
10+
- package-ecosystem: github-actions
11+
directory: /
12+
schedule:
13+
interval: weekly
14+
commit-message:
15+
prefix: "ci"
16+
17+
- package-ecosystem: docker
18+
directory: /
19+
schedule:
20+
interval: weekly
21+
commit-message:
22+
prefix: "docker"

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
types:
11+
- opened
12+
- synchronize
13+
- reopened
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
build-and-test:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: actions/setup-go@v5
25+
with:
26+
go-version-file: go.mod
27+
28+
- name: Build
29+
run: go build ./...
30+
31+
- name: Test
32+
run: go test -race -coverprofile=coverage.out ./...
33+
34+
- name: Vet
35+
run: go vet ./...
36+
37+
yamllint:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Run yamllint
43+
uses: frenck/action-yamllint@v1
44+
45+
docker:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: Build Docker image
51+
run: docker build -t sigrok-mcp-server .

Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Build stage
2+
FROM golang:1.23-bookworm AS builder
3+
4+
WORKDIR /build
5+
6+
COPY go.mod go.sum* ./
7+
RUN go mod download
8+
9+
COPY . .
10+
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /sigrok-mcp-server ./cmd/sigrok-mcp-server
11+
12+
# Runtime stage
13+
FROM debian:bookworm-slim
14+
15+
RUN apt-get update && \
16+
apt-get install -y --no-install-recommends sigrok-cli && \
17+
apt-get clean && \
18+
rm -rf /var/lib/apt/lists/*
19+
20+
COPY --from=builder /sigrok-mcp-server /usr/local/bin/sigrok-mcp-server
21+
22+
ENTRYPOINT ["sigrok-mcp-server"]

cmd/sigrok-mcp-server/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
)
7+
8+
func main() {
9+
fmt.Fprintln(os.Stderr, "sigrok-mcp-server: not yet implemented")
10+
os.Exit(1)
11+
}

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/KenosInc/sigrok-mcp-server
2+
3+
go 1.23

0 commit comments

Comments
 (0)