Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
# Exclude folders not relevant for build
/args
/bin
/tmp/*
/local
/dev
/test
/dev-setup
/example
/.github
/.idea

*.test
*.coverprofile
*.html
.vscode
.idea
.claude
.DS_Store
*~

# Virtual go & fuse
.virtualgo
.fuse_hidden*

# GitGuardian
.cache_ggshield

# gosec
gosec-report.sarif
19 changes: 18 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ jobs:
value:
- test


gardener-landscape-kit:
permissions:
contents: read
Expand Down Expand Up @@ -146,3 +145,21 @@ jobs:
type: localBlob
localReference: >-
gardener-landscape-kit-${{ matrix.args.os }}-${{ matrix.args.arch }}.archive

oci-images:
name: Build OCI-Images
uses: gardener/cc-utils/.github/workflows/oci-ocm.yaml@master
needs:
- prepare
- tests
secrets: inherit
permissions:
contents: read
packages: write
id-token: write
with:
name: gardener-landscape-kit
version: ${{ needs.prepare.outputs.version }}
oci-registry: ${{ needs.prepare.outputs.oci-registry }}
oci-repository: gardener/gardener-landscape-kit
oci-platforms: linux/arm64,linux/amd64
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# builder
FROM --platform=$BUILDPLATFORM golang:1.26.0 AS builder

ARG EFFECTIVE_VERSION
ARG TARGETOS
ARG TARGETARCH
ARG GOPROXY=https://proxy.golang.org,direct
ENV GOPROXY=$GOPROXY
WORKDIR /go/src/github.com/gardener/gardener-landscape-kit

COPY go.mod go.sum ./
RUN go mod download

COPY . .
RUN make build EFFECTIVE_VERSION=$EFFECTIVE_VERSION GOOS=$TARGETOS GOARCH=$TARGETARCH BUILD_OUTPUT_FILE="/output/bin/"

# distroless-static
FROM gcr.io/distroless/static-debian13:nonroot AS distroless-static

# gardener-landscape-kit
FROM distroless-static AS gardener-landscape-kit
COPY --from=builder /output/bin/gardener-landscape-kit /gardener-landscape-kit
WORKDIR /
ENTRYPOINT ["/gardener-landscape-kit"]
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ HACK_DIR := $(REPO_ROOT)/hack
ENSURE_GARDENER_MOD := $(shell go get github.com/gardener/gardener@$$(go list -m -f "{{.Version}}" github.com/gardener/gardener))
GARDENER_HACK_DIR := $(shell go list -m -f "{{.Dir}}" github.com/gardener/gardener)/hack
LD_FLAGS := "-w $(shell bash $(GARDENER_HACK_DIR)/get-build-ld-flags.sh k8s.io/component-base $(REPO_ROOT)/VERSION $(NAME))"
IMAGE_REGISTRY ?= europe-docker.pkg.dev/gardener-project/snapshots/gardener/gardener-landscape-kit
TARGET_PLATFORMS ?= linux/$(shell go env GOARCH)

#########################################
# Tools #
Expand All @@ -34,6 +36,11 @@ build:
install:
@LD_FLAGS=$(LD_FLAGS) bash $(GARDENER_HACK_DIR)/install.sh ./cmd/...

.PHONY: docker-images
docker-images:
@echo "Building docker images with version and tag $(EFFECTIVE_VERSION) for target platforms $(TARGET_PLATFORMS)"
@docker build --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(TARGET_PLATFORMS) -t $(IMAGE_REGISTRY):$(EFFECTIVE_VERSION) -t $(IMAGE_REGISTRY):latest -f Dockerfile --target gardener-landscape-kit .

.PHONY: tidy
tidy:
@GO111MODULE=on go mod tidy
Expand Down