-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (34 loc) · 1.26 KB
/
Dockerfile
File metadata and controls
46 lines (34 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# ---------------------------------------------------------#
# Build Harness image #
# ---------------------------------------------------------#
FROM --platform=$BUILDPLATFORM golang:1.25.1-alpine AS builder
# Setup working dir
WORKDIR /app
ARG TARGETOS
ARG TARGETARCH
# Get dependencies - will also be cached if we won't change mod/sum
COPY go.mod .
COPY go.sum .
# COPY the source code as the last step
COPY . .
# set required build flags
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 \
GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -o mcp-server ./cmd/harness-mcp-server
### Pull CA Certs
FROM --platform=$BUILDPLATFORM alpine:latest AS cert-image
RUN apk --update add ca-certificates
# ---------------------------------------------------------#
# Create final image #
# ---------------------------------------------------------#
FROM alpine:3.21 AS final
# setup app dir and its content
WORKDIR /app
VOLUME /data
ENV XDG_CACHE_HOME=/data
COPY --from=builder /app/mcp-server /app/mcp-server
COPY --from=cert-image /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
ENTRYPOINT ["/app/mcp-server"]
CMD ["stdio"]