Merge pull request #217 from erthalion/feature/debug-mode
Add debug mode
This commit is contained in:
		
						commit
						124cdd1f8e
					
				
							
								
								
									
										15
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										15
									
								
								Makefile
								
								
								
								
							|  | @ -10,7 +10,8 @@ endif | |||
| 
 | ||||
| LOCAL_BUILD_FLAGS ?= $(BUILD_FLAGS) | ||||
| LDFLAGS ?= -X=main.version=$(VERSION) | ||||
| DOCKERFILE = docker/Dockerfile | ||||
| DOCKERDIR = docker | ||||
| 
 | ||||
| IMAGE ?= registry.opensource.zalan.do/acid/$(BINARY) | ||||
| TAG ?= $(VERSION) | ||||
| GITHEAD = $(shell git rev-parse --short HEAD) | ||||
|  | @ -21,6 +22,14 @@ VERSION ?= $(shell git describe --tags --always --dirty) | |||
| DIRS := cmd pkg | ||||
| PKG := `go list ./... | grep -v /vendor/` | ||||
| 
 | ||||
| ifeq ($(DEBUG),1) | ||||
| 	DOCKERFILE = DebugDockerfile | ||||
| 	DEBUG_POSTFIX := -debug | ||||
| 	BUILD_FLAGS += -gcflags "-N -l" | ||||
| else | ||||
| 	DOCKERFILE = Dockerfile | ||||
| endif | ||||
| 
 | ||||
| PATH := $(GOPATH)/bin:$(PATH) | ||||
| SHELL := env PATH=$(PATH) $(SHELL) | ||||
| 
 | ||||
|  | @ -42,8 +51,8 @@ docker-context: scm-source.json linux | |||
| 	mkdir -p docker/build/ | ||||
| 	cp build/linux/${BINARY} scm-source.json docker/build/ | ||||
| 
 | ||||
| docker: ${DOCKERFILE} docker-context | ||||
| 	cd docker && docker build --rm -t "$(IMAGE):$(TAG)" . | ||||
| docker: ${DOCKERDIR}/${DOCKERFILE} docker-context | ||||
| 	cd "${DOCKERDIR}" && docker build --rm -t "$(IMAGE):$(TAG)$(DEBUG_POSTFIX)" -f "${DOCKERFILE}" . | ||||
| 
 | ||||
| indocker-race: | ||||
| 	docker run --rm -v "${GOPATH}":"${GOPATH}" -e GOPATH="${GOPATH}" -e RACE=1 -w ${PWD} golang:1.8.1 bash -c "make linux" | ||||
|  |  | |||
|  | @ -0,0 +1,10 @@ | |||
| FROM alpine | ||||
| MAINTAINER Team ACID @ Zalando <team-acid@zalando.de> | ||||
| 
 | ||||
| # We need root certificates to deal with teams api over https | ||||
| RUN apk --no-cache add ca-certificates go git musl-dev | ||||
| RUN go get github.com/derekparker/delve/cmd/dlv | ||||
| 
 | ||||
| COPY build/* / | ||||
| 
 | ||||
| CMD ["/root/go/bin/dlv", "--listen=:777", "--headless=true", "--api-version=2", "exec", "/postgres-operator"] | ||||
		Loading…
	
		Reference in New Issue