From f2cd6b7b9ab5c18f3a11a85053730b00d8d7a9a1 Mon Sep 17 00:00:00 2001 From: Ramkumar Chinchani Date: Wed, 14 Aug 2019 16:26:25 -0700 Subject: [PATCH] build: support building inside a container using stacker --- Makefile | 4 ++++ README.md | 8 +++++++- stacker.yaml | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 stacker.yaml diff --git a/Makefile b/Makefile index b5d51b27..98871ddd 100644 --- a/Makefile +++ b/Makefile @@ -42,3 +42,7 @@ binary-container: ${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f Dockerfile -t zot:latest . ${CONTAINER_RUNTIME} run --rm --security-opt label=disable -v $$(pwd):/go/src/github.com/anuvu/zot \ zot:latest make + +.PHONY: binary-stacker +binary-stacker: + stacker build --substitute PWD=$$PWD --no-cache diff --git a/README.md b/README.md index 12e4cf37..805c9579 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,12 @@ make binary-container ``` +* Alternatively, build inside a container using [stacker](https://github.com/anuvu/stacker) (preferred) + +``` +make binary-stacker +``` + * Build using host's toolchain ``` @@ -28,7 +34,7 @@ Build artifacts are in bin/ # Running -bin/zot serve __ +bin/zot serve # Caveats diff --git a/stacker.yaml b/stacker.yaml new file mode 100644 index 00000000..af627cb7 --- /dev/null +++ b/stacker.yaml @@ -0,0 +1,16 @@ +build: + from: + type: docker + url: docker://golang:1.12.8 + binds: + - ${{PWD}} -> /go/src/github.com/anuvu/zot + run: | + export GO111MODULE=on + export GOPATH='/go' + export HOME='/root' + export PATH='/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' + go get -u github.com/swaggo/swag/cmd/swag + cd /go/src/github.com/anuvu/zot + curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.17.1 + make + build_only: true