-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.webhook
35 lines (28 loc) · 939 Bytes
/
Dockerfile.webhook
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
# syntax=docker/dockerfile:latest
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.23-alpine as builder
RUN apk update
RUN apk add make bash
WORKDIR /workspace
COPY go.mod go.sum ./
RUN go mod download
# Copy the go source
COPY Makefile.build Makefile
COPY cmd/webhook cmd/webhook
COPY pkg pkg
ARG TARGETOS TARGETARCH TARGETVARIANT
RUN if [[ -n "${TARGETVARIANT}" ]]; then export GOARM=${TARGETVARIANT}; fi
# Build
RUN --mount=type=cache,target=/root/.cache/go-build GOOS=$TARGETOS GOARCH=$TARGETARCH \
INJECTOR_WEBHOOK_BUILD_OUTPUT_PATH=/build/bin/injector-webhook \
make injector-webhook
RUN ls -la /build/bin
FROM alpine
LABEL org.opencontainers.image.source https://github.com/janekbaraniewski/kubeserial
WORKDIR /
ENV USER_NAME=kubeserial \
USER_UID=1001
COPY entrypoint entrypoint
COPY --from=builder /build/bin/injector-webhook .
ENTRYPOINT ["/entrypoint", "/injector-webhook"]
USER ${USER_UID}