Improvements for debug mode
Return back `cd docker` part to be less invasive, and add `-debug` postfix for image
This commit is contained in:
		
							parent
							
								
									bf7df5d5b5
								
							
						
					
					
						commit
						09abdce095
					
				
							
								
								
									
										23
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										23
									
								
								Makefile
								
								
								
								
							|  | @ -8,18 +8,9 @@ ifeq ($(RACE),1) | |||
|     CGO_ENABLED=1 | ||||
| endif | ||||
| 
 | ||||
| ifeq ($(DEBUG),1) | ||||
| 	BUILD_FLAGS += -gcflags "-N -l" | ||||
| endif | ||||
| 
 | ||||
| LOCAL_BUILD_FLAGS ?= $(BUILD_FLAGS) | ||||
| LDFLAGS ?= -X=main.version=$(VERSION) | ||||
| 
 | ||||
| ifeq ($(DEBUG),1) | ||||
| 	DOCKERFILE = docker/DebugDockerfile | ||||
| else | ||||
| 	DOCKERFILE = docker/Dockerfile | ||||
| endif | ||||
| DOCKERDIR = docker | ||||
| 
 | ||||
| IMAGE ?= registry.opensource.zalan.do/acid/$(BINARY) | ||||
| TAG ?= $(VERSION) | ||||
|  | @ -31,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) | ||||
| 
 | ||||
|  | @ -52,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 | ||||
| 	docker build --rm -t "$(IMAGE):$(TAG)" -f "${DOCKERFILE}" . | ||||
| 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" | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue