-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
33 lines (27 loc) · 886 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
# 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/manager cmd/manager
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 \
KUBESERIAL_BUILD_OUTPUT_PATH=/build/bin/kubeserial \
make kubeserial
FROM alpine
LABEL org.opencontainers.image.source https://github.com/janekbaraniewski/kubeserial
WORKDIR /
ENV USER_NAME=kubeserial \
USER_UID=1001
COPY --from=builder /build/bin/kubeserial .
COPY entrypoint entrypoint
ENTRYPOINT ["/entrypoint", "/kubeserial"]
USER ${USER_UID}