Skip to content

Commit a985b08

Browse files
tiwilliaclaude
andcommitted
Add containerization support with Red Hat UBI9 images
- Add Containerfile using UBI9 go-toolset for build and ubi-minimal for runtime - Add container-build, container-run, and container-clean make targets using podman - Update go.mod to use Go 1.24.4 for UBI9 compatibility - Container runs SSE transport on port 8080 with verbose logging 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent c15ff3b commit a985b08

File tree

3 files changed

+62
-2
lines changed

3 files changed

+62
-2
lines changed

Containerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Build stage using UBI9 Go toolset
2+
FROM registry.access.redhat.com/ubi9/go-toolset:latest AS builder
3+
4+
# Switch to root to install dependencies
5+
USER 0
6+
7+
# Set working directory
8+
WORKDIR /app
9+
10+
# Copy go mod files
11+
COPY go.mod go.sum ./
12+
13+
# Download dependencies
14+
RUN go mod download
15+
16+
# Copy source code
17+
COPY . .
18+
19+
# Build the binary
20+
RUN go build -o rosa-mcp-server ./cmd/rosa-mcp-server
21+
22+
# Runtime stage using minimal UBI9
23+
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
24+
25+
# Install ca-certificates for HTTPS requests to OCM
26+
RUN microdnf install -y ca-certificates && microdnf clean all
27+
28+
# Create non-root user
29+
RUN groupadd -r rosa && useradd -r -g rosa rosa
30+
31+
# Set working directory
32+
WORKDIR /app
33+
34+
# Copy binary from builder stage
35+
COPY --from=builder /app/rosa-mcp-server .
36+
37+
# Change ownership to non-root user
38+
RUN chown rosa:rosa /app/rosa-mcp-server
39+
40+
# Switch to non-root user
41+
USER rosa
42+
43+
# Expose port 8080 for SSE transport
44+
EXPOSE 8080
45+
46+
# Default command runs with SSE transport on port 8080
47+
CMD ["./rosa-mcp-server", "--transport=sse", "--port=8080"]

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build run clean
1+
.PHONY: build run clean container-build container-run container-clean
22

33
# Build the rosa-mcp-server binary
44
build:
@@ -11,3 +11,16 @@ run: build
1111
# Clean build artifacts
1212
clean:
1313
rm -f rosa-mcp-server
14+
15+
# Build container image
16+
container-build:
17+
podman build -t rosa-mcp-server:latest .
18+
19+
# Run container with SSE transport and verbose logging
20+
container-run: container-build
21+
podman run --rm -p 8080:8080 \
22+
rosa-mcp-server:latest ./rosa-mcp-server --transport=sse --port=8080 -v=3
23+
24+
# Clean container image
25+
container-clean:
26+
podman rmi rosa-mcp-server:latest

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/tiwillia/rosa-mcp-go
22

3-
go 1.24.5
3+
go 1.24.4
44

55
require (
66
github.com/BurntSushi/toml v1.5.0

0 commit comments

Comments
 (0)