-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 960 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (23 loc) · 960 Bytes
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
FROM --platform=linux/amd64 golang:1.24-alpine AS builder
RUN mkdir -p /app/chalk-benchmark/
WORKDIR /app/chalk-benchmark
COPY go.mod go.sum ./
# This requies buildkit
RUN go env -w GOCACHE=/go-cache
RUN go env -w GOMODCACHE=/gomod-cache
RUN --mount=type=cache,target=/gomod-cache go mod download
COPY . .
RUN --mount=type=cache,target=/gomod-cache \
--mount=type=cache,target=/go-cache \
CGO_ENABLED=0 GOOS=linux \
go build \
-ldflags="-s -w -X 'github.com/chalk-ai/chalk-private/chalk-benchmark/info.Sha=$COMMIT_SHA'"
# Run stage
FROM --platform=linux/amd64 alpine
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Copy the built binary from the builder stage
RUN mkdir -p /usr/local/bin/chalk-benchmark/
COPY --from=builder /app/chalk-benchmark/chalk-benchmark /usr/local/bin/chalk-benchmark/chalk-benchmark
# Set the working directory
WORKDIR /app
CMD ["/usr/local/bin/chalk-benchmark", "grpc", "--log-json"]