-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (20 loc) · 836 Bytes
/
Dockerfile
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
# stage: build ---------------------------------------------------------
FROM golang:1.22-alpine as build
RUN apk add --no-cache gcc musl-dev linux-headers
WORKDIR /go/src/github.com/flashbots/kube-sidecar-injector
COPY go.* ./
RUN go mod download
COPY . .
ARG VERSION
RUN --mount=type=cache,target=/root/.cache/go-build \
go build \
-o bin/kube-sidecar-injector \
-ldflags "-s -w -X main.version=${VERSION}" \
github.com/flashbots/kube-sidecar-injector/cmd
# stage: run -----------------------------------------------------------
# TODO: change for distroless
FROM alpine
RUN apk add --no-cache ca-certificates
WORKDIR /app
COPY --from=build /go/src/github.com/flashbots/kube-sidecar-injector/bin/kube-sidecar-injector ./kube-sidecar-injector
ENTRYPOINT ["/app/kube-sidecar-injector"]