-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (33 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
42 lines (33 loc) · 1.03 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
FROM --platform=${BUILDPLATFORM} golang:1.25.5-alpine3.21@sha256:b4dbd292a0852331c89dfd64e84d16811f3e3aae4c73c13d026c4d200715aff6 AS builder
# Dependencies required to run the race detector
RUN \
--mount=type=cache,target=/var/cache/apk \
apk add --no-cache gcc musl-dev
WORKDIR /go/src/app
COPY go.mod go.sum ./
RUN \
--mount=type=cache,target=/go/pkg/mod <<EOF
go mod download
go mod verify
EOF
COPY . .
# `go test` requires cgo
RUN \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=1 go test -race -v ./...
RUN \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 \
GOOS=${TARGETOS} \
GOARCH=${TARGETARCH} \
\
go \
build \
-ldflags="-w -s" \
-o /go/bin/app \
github.com/grafana/wait-for-github/cmd/wait-for-github
FROM gcr.io/distroless/static-debian12@sha256:cd64bec9cec257044ce3a8dd3620cf83b387920100332f2b041f19c4d2febf93
COPY --from=builder /go/bin/app /go/bin/app
ENTRYPOINT ["/go/bin/app"]