# goal for this make file is to generate dockerfile from an upstream project

DOCKER_FILE ?=
DOCKER_FILE_URL ?=

PROXY_CONFIG_CONTENT ?= $(shell cat $(PROXY_DOCKER_ENV_FILE))

include mk/utils/proxy.mk

get-upstream-dockerfile:
		# get the dockerfile.machine from github.com/docker/machine
		curl -s $(DOCKER_FILE_URL) > $(DOCKER_FILE)

gen-dockerfile: proxy-config get-upstream-dockerfile
		echo 'generating docker file'
		echo 'cat $(PROXY_DOCKER_ENV_FILE)'
		sed "/FROM.*/ r $(PROXY_DOCKER_ENV_FILE)" $(DOCKER_FILE) > $(DOCKER_FILE).t && mv $(DOCKER_FILE).t $(DOCKER_FILE)
		# setup workdir and add current folder as /go/src/github.com/$GH_USER/$GH_REPO
		sed "s#WORKDIR.*#WORKDIR /go/src/github.com/$(GH_USER)/$(GH_REPO)#g" $(DOCKER_FILE) > $(DOCKER_FILE).t && mv $(DOCKER_FILE).t $(DOCKER_FILE)
		sed "s#ADD.*#ADD . /go/src/github.com/$(GH_USER)/$(GH_REPO)#g" $(DOCKER_FILE) > $(DOCKER_FILE).t && mv $(DOCKER_FILE).t $(DOCKER_FILE)

# goal for this make file is to generate dockerfile from an upstream project

DOCKER_FILE ?=
DOCKER_FILE_URL ?=

PROXY_CONFIG_CONTENT ?= $(shell cat $(PROXY_DOCKER_ENV_FILE))

include mk/utils/proxy.mk

get-upstream-dockerfile:
		# get the dockerfile.machine from github.com/docker/machine
		curl -s $(DOCKER_FILE_URL) > $(DOCKER_FILE)

gen-dockerfile: proxy-config get-upstream-dockerfile
		echo 'generating docker file'
		echo 'cat $(PROXY_DOCKER_ENV_FILE)'
		sed "/FROM.*/ r $(PROXY_DOCKER_ENV_FILE)" $(DOCKER_FILE) > $(DOCKER_FILE).t && mv $(DOCKER_FILE).t $(DOCKER_FILE)
		# setup workdir and add current folder as /go/src/github.com/$GH_USER/$GH_REPO
		sed "s#WORKDIR.*#WORKDIR /go/src/github.com/$(GH_USER)/$(GH_REPO)#g" $(DOCKER_FILE) > $(DOCKER_FILE).t && mv $(DOCKER_FILE).t $(DOCKER_FILE)
		sed "s#COPY.*#COPY . /go/src/github.com/$(GH_USER)/$(GH_REPO)#g" $(DOCKER_FILE) > $(DOCKER_FILE).t && mv $(DOCKER_FILE).t $(DOCKER_FILE)

Fix the build Dockerfile gen
Fix the build Dockerfile gen

Upstream changed dockerfile from ADD to COPY
update our make step for the dockerfile to subst for COPY

Signed-off-by: Edward Raigosa <94e01cd489130787c3de55af9008bde6850741cb@gmail.com>
