Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mcp-servers/go/benchmark-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM --platform=$TARGETPLATFORM golang:1.23 AS builder
# This build supports multi-platform builds through standard Docker Buildx
# techniques, including the $TARGETPLATFORM environment variable.
FROM golang:1.23 AS builder
WORKDIR /src
COPY go.mod .
RUN go mod download
Expand All @@ -7,4 +9,5 @@ RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-s -w" -o /usr/local/b

FROM scratch
COPY --from=builder /usr/local/bin/benchmark-server /benchmark-server
USER 1001:1001
ENTRYPOINT ["/benchmark-server"]
8 changes: 6 additions & 2 deletions mcp-servers/go/fast-time-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
# Build: docker build -t fast-time-server:latest --build-arg VERSION=$(git rev-parse --short HEAD) .
# Run : docker run --rm -p 8080:8080 fast-time-server:latest
# # now visit http://localhost:8080/sse or http://localhost:8080/http
#
# This build supports multi-platform builds through standard Docker Buildx
# techniques, including the $TARGETPLATFORM environment variable.
# =============================================================================

# =============================================================================
# πŸ—οΈ STAGE 1 - BUILD STATIC BINARY (Go 1.23, CGO disabled)
# =============================================================================
FROM --platform=$TARGETPLATFORM golang:1.23 AS builder
FROM golang:1.23 AS builder

WORKDIR /src
COPY go.mod go.sum ./
Expand All @@ -31,7 +34,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build \
# πŸ“¦ STAGE 2 - MINIMAL RUNTIME (scratch + tzdata + binary)
# =============================================================================
FROM scratch
LABEL org.opencontainers.image.source https://github.com/IBM/mcp-context-forge
LABEL org.opencontainers.image.source=https://github.com/IBM/mcp-context-forge

# copy tzdata so time.LoadLocation works
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
Expand All @@ -40,5 +43,6 @@ COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /usr/local/bin/fast-time-server /fast-time-server

# --- default: SSE + HTTP on 8080 ---
USER 1001:1001
ENTRYPOINT ["/fast-time-server"]
CMD ["-transport=dual", "-port=8080", "-listen=0.0.0.0"]
8 changes: 6 additions & 2 deletions mcp-servers/templates/go/Dockerfile.jinja
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Multi-stage container for {{ project_name }}

FROM --platform=$TARGETPLATFORM golang:{{ go_version }} AS builder
# This build supports multi-platform builds through standard Docker Buildx
# techniques, including the $TARGETPLATFORM environment variable.

FROM golang:{{ go_version }} AS builder
WORKDIR /src

COPY go.mod .
Expand All @@ -10,9 +13,10 @@ COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-s -w" -o /usr/local/bin/{{ bin_name }} .

FROM scratch
LABEL org.opencontainers.image.source https://github.com/contextforge/mcp-context-forge
LABEL org.opencontainers.image.source=https://github.com/contextforge/mcp-context-forge

COPY --from=builder /usr/local/bin/{{ bin_name }} /{{ bin_name }}

USER 1001:1001
ENTRYPOINT ["/{{ bin_name }}"]

Loading