Removed go dependency on make
This commit is contained in:
14
clitools/docker/crdgen.Dockerfile
Normal file
14
clitools/docker/crdgen.Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
ARG BASE_IMAGE=localhost/monok8s/ctl-build-base:dev
|
||||
FROM ${BASE_IMAGE} AS build
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
RUN GOBIN=/usr/local/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.20.1
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN mkdir -p /out && \
|
||||
controller-gen crd paths=./pkg/apis/... output:crd:dir=/out
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /out/ /
|
||||
8
clitools/docker/ctl-build-base.Dockerfile
Normal file
8
clitools/docker/ctl-build-base.Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM golang:1.26-alpine
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
RUN apk add --no-cache git build-base
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
24
clitools/docker/ctl-builder-local.Dockerfile
Normal file
24
clitools/docker/ctl-builder-local.Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
FROM golang:1.26-alpine AS build
|
||||
|
||||
ARG VERSION
|
||||
ARG KUBE_VERSION
|
||||
ARG GIT_REV=unknown
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
RUN apk add --no-cache git build-base
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN test -f pkg/buildinfo/buildinfo_gen.go
|
||||
|
||||
RUN mkdir -p /out && \
|
||||
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 \
|
||||
go build -trimpath -ldflags="-s -w" \
|
||||
-o /out/ctl-${VERSION} ./cmd/ctl
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /out/ /
|
||||
20
clitools/docker/ctl-builder.Dockerfile
Normal file
20
clitools/docker/ctl-builder.Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
ARG BASE_IMAGE=localhost/monok8s/ctl-build-base:dev
|
||||
FROM ${BASE_IMAGE} AS build
|
||||
|
||||
ARG VERSION=dev
|
||||
ARG TARGETOS=linux
|
||||
ARG TARGETARCH=arm64
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN test -f pkg/buildinfo/buildinfo_gen.go
|
||||
|
||||
RUN mkdir -p /out && \
|
||||
GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 \
|
||||
go build -trimpath -ldflags="-s -w" \
|
||||
-o /out/ctl-linux-aarch64-${VERSION} ./cmd/ctl
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /out/ /
|
||||
Reference in New Issue
Block a user