Skip to content

Commit c04390b

Browse files
committed
Add build and push image to repo
1 parent 280e3da commit c04390b

File tree

3 files changed

+157
-12
lines changed

3 files changed

+157
-12
lines changed

.github/workflows/build.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build and Push Container Images
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v[0-9]+.[0-9]+.[0-9]+'
9+
pull_request:
10+
types:
11+
- opened
12+
- reopened
13+
- synchronize
14+
15+
env:
16+
REGISTRY: quay.io
17+
IMAGE_NAME: stackrox-io/mcp
18+
19+
jobs:
20+
build-and-push:
21+
runs-on: ubuntu-latest
22+
23+
permissions:
24+
contents: read
25+
packages: write
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Set up QEMU
32+
uses: docker/setup-qemu-action@v3
33+
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
37+
# TEST-ONLY!!!
38+
# - name: Log in to Quay.io
39+
# uses: docker/login-action@v3
40+
# with:
41+
# registry: ${{ env.REGISTRY }}
42+
# username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
43+
# password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
44+
45+
- name: Extract metadata (tags, labels)
46+
id: meta
47+
uses: docker/metadata-action@v5
48+
with:
49+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
50+
tags: |
51+
type=semver,pattern={{version}}
52+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
53+
type=sha,prefix=,format=short,enable={{is_default_branch}}
54+
labels: |
55+
summary=StackRox MCP Server
56+
description=Model Context Protocol server for StackRox
57+
maintainer="https://stackrox.io/"
58+
vendor=StackRox
59+
60+
- name: Build and push multi-arch image
61+
uses: docker/build-push-action@v5
62+
with:
63+
context: .
64+
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
65+
# TEST-ONLY!!!
66+
push: false
67+
tags: ${{ steps.meta.outputs.tags }}
68+
labels: ${{ steps.meta.outputs.labels }}
69+
cache-from: type=gha
70+
cache-to: type=gha,mode=max
71+
build-args: |
72+
VERSION=${{ steps.meta.outputs.version }}
73+
74+
- name: Generate build summary
75+
run: |
76+
echo "## Build Summary" >> $GITHUB_STEP_SUMMARY
77+
echo "" >> $GITHUB_STEP_SUMMARY
78+
echo "**Registry**: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" >> $GITHUB_STEP_SUMMARY
79+
echo "" >> $GITHUB_STEP_SUMMARY
80+
echo "**Tags**:" >> $GITHUB_STEP_SUMMARY
81+
echo '```' >> $GITHUB_STEP_SUMMARY
82+
echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
83+
echo '```' >> $GITHUB_STEP_SUMMARY
84+
echo "" >> $GITHUB_STEP_SUMMARY
85+
echo "**Platforms**: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x" >> $GITHUB_STEP_SUMMARY

Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# Binary name
55
BINARY_NAME=stackrox-mcp
66

7-
# Version (can be overridden with VERSION=x.y.z make build)
8-
VERSION?=0.1.0
7+
# Version can be overridden with VERSION=x.y.z make build (default: extracted from git tags or use dev)
8+
VERSION?=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
99

1010
# Go parameters
1111
GOCMD=go
@@ -40,7 +40,18 @@ build: ## Build the binary
4040

4141
.PHONY: image
4242
image: ## Build the docker image
43-
$(DOCKER_CMD) build -t quay.io/stackrox-io/stackrox-mcp:$(VERSION) .
43+
$(DOCKER_CMD) build \
44+
--build-arg VERSION=$(VERSION) \
45+
-t quay.io/stackrox-io/mcp:$(VERSION) \
46+
.
47+
48+
.PHONY: image-multiarch
49+
image-multiarch: ## Build multi-architecture docker image
50+
$(DOCKER_CMD) buildx build \
51+
--platform linux/amd64,linux/arm64,linux/ppc64le,linux/s390x \
52+
--build-arg VERSION=$(VERSION) \
53+
-t quay.io/stackrox-io/mcp:$(VERSION) \
54+
.
4455

4556
.PHONY: dockerfile-lint
4657
dockerfile-lint: ## Run hadolint for Dockerfile

README.md

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,33 +173,82 @@ You: "Can you list all the clusters from StackRox?"
173173
Claude: [Uses list_clusters tool to retrieve cluster information]
174174
```
175175

176-
## Docker
176+
## Container Images
177177

178-
### Building the Docker Image
178+
### Registry
179+
180+
Official images are published to Quay.io:
181+
182+
```
183+
quay.io/stackrox-io/mcp
184+
```
185+
186+
### Supported Architectures
187+
188+
Multi-architecture images support the following platforms:
189+
190+
- `linux/amd64` - Standard x86_64 architecture
191+
- `linux/arm64` - ARM 64-bit (Apple Silicon, AWS Graviton, etc.)
192+
- `linux/ppc64le` - IBM POWER architecture
193+
- `linux/s390x` - IBM Z mainframe architecture
194+
195+
Docker/Podman will automatically pull the correct image for your platform.
196+
197+
### Available Tags
198+
199+
| Tag Pattern | Description | Example |
200+
|-------------|-------------|---------|
201+
| `latest` | Latest release version | `quay.io/stackrox-io/mcp:latest` |
202+
| `v{version}` | Specific release version | `quay.io/stackrox-io/mcp:v1.0.0` |
203+
| `{commit-sha}` | Specific commit from main branch | `quay.io/stackrox-io/mcp:a1b2c3d` |
204+
205+
### Usage
206+
207+
#### Pull Image
179208

180-
Build the image locally:
181209
```bash
182-
VERSION=dev make image
210+
docker pull quay.io/stackrox-io/mcp:latest
211+
# or
212+
podman pull quay.io/stackrox-io/mcp:latest
183213
```
184214

185-
### Running the Container
215+
#### Run Container
186216

187-
Run with default settings:
188217
```bash
189-
docker run --publish 8080:8080 --env STACKROX_MCP__TOOLS__CONFIG_MANAGER__ENABLED=true --env STACKROX_MCP__CENTRAL__URL=<central host:port> quay.io/stackrox-io/stackrox-mcp:dev
218+
docker run -p 8080:8080 \
219+
--env STACKROX_MCP__CENTRAL__URL=central.stackrox:443 \
220+
--env STACKROX_MCP__TOOLS__CONFIG_MANAGER__ENABLED=true \
221+
quay.io/stackrox-io/mcp:latest
222+
```
223+
224+
### Building Images Locally
225+
226+
Build a single-platform image:
227+
```bash
228+
VERSION=dev make image
190229
```
191230

192231
### Build Arguments
193232

194233
- `TARGETOS` - Target operating system (default: `linux`)
195234
- `TARGETARCH` - Target architecture (default: `amd64`)
196-
- `VERSION` - Application version (default: `dev`)
235+
- `VERSION` - Application version (default: auto-detected from git)
197236

198237
### Image Details
199238

200239
- **Base Image**: Red Hat UBI10-micro (minimal, secure)
201-
- **User**: Non-root user `mcp` (UID/GID 4000)
240+
- **User**: Non-root user (UID/GID 4000)
202241
- **Port**: 8080
242+
- **Health Check**: Built-in health endpoint at `/health`
243+
244+
### Automated Builds
245+
246+
Images are automatically built and pushed on:
247+
248+
- **Main branch commits**: Tagged with commit SHA
249+
- **Version tags**: Tagged with version number and `latest`
250+
251+
See [.github/workflows/build.yml](.github/workflows/build.yml) for build pipeline details.
203252

204253
## Development
205254

0 commit comments

Comments
 (0)