Skip to content

Commit 79b1237

Browse files
committed
add Dockerfile
1 parent 4701e8e commit 79b1237

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# ---------------------------------------------------------#
2+
# Build Harness image #
3+
# ---------------------------------------------------------#
4+
FROM --platform=$BUILDPLATFORM golang:1.24.3-alpine AS builder
5+
6+
# Setup workig dir
7+
WORKDIR /app
8+
9+
# Get dependencies - will also be cached if we won't change mod/sum
10+
COPY go.mod .
11+
COPY go.sum .
12+
13+
# COPY the source code as the last step
14+
COPY . .
15+
16+
# set required build flags
17+
RUN --mount=type=cache,target=/root/.cache/go-build \
18+
--mount=type=cache,target=/go/pkg \
19+
CGO_ENABLED=0 \
20+
GOOS=$TARGETOS GOARCH=$TARGETARCH \
21+
go build -o ./cmd/harness-mcp-server/harness-mcp-server ./cmd/harness-mcp-server
22+
23+
### Pull CA Certs
24+
FROM --platform=$BUILDPLATFORM alpine:latest AS cert-image
25+
26+
RUN apk --update add ca-certificates
27+
28+
# ---------------------------------------------------------#
29+
# Create final image #
30+
# ---------------------------------------------------------#
31+
FROM alpine:3.21 AS final
32+
33+
# setup app dir and its content
34+
WORKDIR /app
35+
VOLUME /data
36+
37+
ENV XDG_CACHE_HOME=/data
38+
39+
COPY --from=builder /app/cmd/harness-mcp-server/harness-mcp-server /app/harness-mcp-server
40+
COPY --from=cert-image /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
41+
42+
ENTRYPOINT [ "/app/harness-mcp-server", "stdio" ]

0 commit comments

Comments
 (0)