Skip to content
Open
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
23 changes: 11 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# Build the manager binary
FROM golang:1.21 as manager
# syntax=docker/dockerfile:1.2

WORKDIR /
FROM golang:1.21 as builder

WORKDIR /app

COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
COPY go.mod go.sum ./
# Cache go modules
RUN --mount=type=cache,target=/go/pkg/mod go mod download

# Copy the go source
COPY cmd cmd
COPY pkg pkg

RUN CGO_ENABLED=0 go build -a -o manager cmd/main.go

FROM d3fk/kubectl:latest as kubectl
ARG GO_BUILD_FLAGS=""
RUN CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} -o manager cmd/main.go

FROM alpine:latest
WORKDIR /
COPY --from=manager /manager .
COPY --from=kubectl /kubectl /usr/bin/kubectl
COPY --from=builder /app/manager .
COPY --from=d3fk/kubectl:latest /kubectl /usr/bin/kubectl

ENTRYPOINT ["/manager"]
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
IMG ?= kondense/kondense:1.0.1
GO_BUILD_FLAGS ?=

# Enable Docker BuildKit
export DOCKER_BUILDKIT=1

all: build

build:
docker build -t ${IMG} .
docker build --build-arg GO_BUILD_FLAGS="${GO_BUILD_FLAGS}" -t ${IMG} .

load:
minikube image load ${IMG}
Expand All @@ -15,4 +19,6 @@ undeploy:
kubectl delete -f manifests

push:
docker push ${IMG}
docker push ${IMG}

.PHONY: all build load deploy undeploy push