Skip to content

Commit af51ba5

Browse files
authored
Merge pull request #2 from flq/dockerfile-change
Add dockerfile support building for different architectures
2 parents 9330327 + 6779f64 commit af51ba5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
ARG GO_VERSION=1.22
33
FROM golang:${GO_VERSION}-alpine AS builder
44

5+
ARG TARGETOS
6+
ARG TARGETARCH
7+
58
WORKDIR /app
69

710
# Copy Go modules and download dependencies first
@@ -15,7 +18,7 @@ COPY . .
1518
# Build the static binary for the command-line tool
1619
# CGO_ENABLED=0 produces a static binary, important for distroless/scratch images
1720
# -ldflags="-s -w" strips debug symbols and DWARF info, reducing binary size
18-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o /openapi-mcp ./cmd/openapi-mcp/main.go
21+
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-s -w" -o /openapi-mcp ./cmd/openapi-mcp/main.go
1922

2023
# --- Final Stage ---
2124
# Use a minimal base image. distroless/static is very small and secure.

0 commit comments

Comments
 (0)