Skip to content

Commit

Permalink
Merge pull request #1562 from kube-logging/docker-debug
Browse files Browse the repository at this point in the history
feat: debug image
  • Loading branch information
kristofgyuracz authored Nov 2, 2023
2 parents 9c979b4 + 9c47c69 commit 5c72338
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ COPY pkg/ pkg/
# Build
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /usr/local/bin/manager

FROM builder as debug

RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go install github.com/go-delve/delve/cmd/dlv@latest

CMD ["/go/bin/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "--accept-multiclient", "exec", "/usr/local/bin/manager"]

FROM gcr.io/distroless/static:latest@sha256:6706c73aae2afaa8201d63cc3dda48753c09bcd6c300762251065c0f7e602b25

Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GOVERSION := $(shell go env GOVERSION)

# Image name to use for building/pushing image targets
IMG ?= controller:local
IMG_DEBUG ?= controller:debug

# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false,maxDescLen=0"
Expand Down Expand Up @@ -79,6 +80,10 @@ docker-build: ## Build the docker image
@echo "updating kustomize image patch file for manager resource"
sed -i'' -e 's@image: .*@image: '"${IMG}"'@' ./config/default/manager_image_patch.yaml

.PHONY: docker-build-debug
docker-build-debug: ## Build the debug docker image
${DOCKER} build --target debug -t ${IMG_DEBUG} .

.PHONY: docker-build-drain-watch
docker-build-drain-watch: ## Build the drain-watch docker image
${DOCKER} build drain-watch-image -t ${DRAIN_WATCH_IMAGE_TAG_NAME}:${DRAIN_WATCH_IMAGE_TAG_VERSION}
Expand Down

0 comments on commit 5c72338

Please sign in to comment.