From 752cda88e315c91136454b7e2f957dfe6de17243 Mon Sep 17 00:00:00 2001 From: Scott Hansen Date: Sun, 12 Jan 2020 17:00:10 -0800 Subject: [PATCH] Add docker-build and docker-install targets to Makefile --- Makefile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 013c6f34..a3888dd2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build clean contrib_check coverage help install isntall lint run size test uninstall +.PHONY: build clean contrib_check coverage docker-build docker-install help install isntall lint run size test uninstall # detect GOPATH if not set ifndef $(GOPATH) @@ -48,6 +48,21 @@ coverage: go test -coverprofile=coverage.out ./... go tool cover -html=coverage.out +## docker-build: builds in docker +docker-build: + @echo "Building ${APP} in Docker..." + docker build -t wtfutil:build --build-arg=version=master -f Dockerfile.build . + @echo "Done with docker build" + +## docker-install: installs a local version of the app from docker build +docker-install: + @echo "Installing ${APP}..." + docker create --name wtf_build wtfutil:build + docker cp wtf_build:/usr/local/bin/wtfutil ~/.local/bin/ + $(eval INSTALLPATH = $(shell which ${APP})) + @echo "${APP} installed into ${INSTALLPATH}" + docker rm wtf_build + ## gosec: runs the gosec static security scanner against the source code gosec: gosec -tests ./...