From 9f8fc940f8d1dc3987cb719016fd1800fdf5ccf3 Mon Sep 17 00:00:00 2001 From: taik0 Date: Sat, 5 May 2018 19:06:26 +0200 Subject: [PATCH 1/2] Avoid the need of dep if we are compiling on docker. --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 94183f9..e22d0e3 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ GOLANG_VERSION=1.9.3-alpine3.7 DEP_VERSION=0.4.1 OS=$(shell uname | tr '[:upper:]' '[:lower:]') PACKAGES=$(shell go list ./...) +GOBASEDIR=src/github.com/devopsfaith/api2html all: deps test build @@ -36,8 +37,9 @@ docker: server_build docker build -t devopsfaith/api2html . rm api2html -server_build: deps - docker run --rm -it -e "GOPATH=/go" -v "${PWD}:/go/src/github.com/devopsfaith/api2html" -w /go/src/github.com/devopsfaith/api2html golang:${GOLANG_VERSION} go build -o api2html +server_build: + docker run --rm -it -e "GOPATH=/go" -v "${PWD}:/go/${GOBASEDIR}" -w /go/${GOBASEDIR} lushdigital/docker-golang-dep ensure -v + docker run --rm -it -e "GOPATH=/go" -v "${PWD}:/go/${GOBASEDIR}" -w /go/${GOBASEDIR} golang:${GOLANG_VERSION} go build -o api2html coveralls: all go get github.com/mattn/goveralls From e16c05f97f8b0bcbdaf12a84f7209c0deaaeec30 Mon Sep 17 00:00:00 2001 From: taik0 Date: Wed, 9 May 2018 20:57:59 +0200 Subject: [PATCH 2/2] Set separate commands for docker. --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e22d0e3..a0ccd1c 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ GOBASEDIR=src/github.com/devopsfaith/api2html all: deps test build +docker_all: docker_deps docker_build + prepare: @echo "Installing statik..." @go get github.com/rakyll/statik @@ -37,8 +39,11 @@ docker: server_build docker build -t devopsfaith/api2html . rm api2html -server_build: +docker_deps: docker run --rm -it -e "GOPATH=/go" -v "${PWD}:/go/${GOBASEDIR}" -w /go/${GOBASEDIR} lushdigital/docker-golang-dep ensure -v + +docker_build: + @echo "You must run make deps or make docker_deps" docker run --rm -it -e "GOPATH=/go" -v "${PWD}:/go/${GOBASEDIR}" -w /go/${GOBASEDIR} golang:${GOLANG_VERSION} go build -o api2html coveralls: all