From 35cc8d095db20efaba1e9930544bf9c4a89e26c2 Mon Sep 17 00:00:00 2001 From: Bradley Cicenas Date: Sun, 19 Mar 2017 04:26:25 +0000 Subject: [PATCH] include Makefile instructions for building image from source --- Dockerfile_build | 12 ++++++++++++ Makefile | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 Dockerfile_build diff --git a/Dockerfile_build b/Dockerfile_build new file mode 100644 index 0000000..aa57a1f --- /dev/null +++ b/Dockerfile_build @@ -0,0 +1,12 @@ +FROM quay.io/vektorcloud/go:1.8 + +RUN apk add --no-cache make + +COPY glide.* /go/src/github.com/bcicen/ctop/ +WORKDIR /go/src/github.com/bcicen/ctop/ +RUN glide install + +COPY . /go/src/github.com/bcicen/ctop +RUN make build && \ + mkdir -p /go/bin && \ + mv -v ctop /go/bin/ diff --git a/Makefile b/Makefile index e115709..53c5e61 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,20 @@ build: glide install CGO_ENABLED=0 go build -tags release -ldflags $(LD_FLAGS) -o ctop +build-dev: + go build -ldflags "-w -X main.version=$(VERSION)-dev -X main.build=$(BUILD)" + build-all: mkdir -p build GOOS=darwin GOARCH=amd64 go build -tags release -ldflags $(LD_FLAGS) -o build/ctop-$(VERSION)-darwin-amd64 GOOS=linux GOARCH=amd64 go build -tags release -ldflags $(LD_FLAGS) -o build/ctop-$(VERSION)-linux-amd64 GOOS=linux GOARCH=arm go build -tags release -ldflags $(LD_FLAGS) -o build/ctop-$(VERSION)-linux-arm +image: + docker build -t ctop_build -f Dockerfile_build . + docker run -ti --rm -v $(shell pwd):/target ctop_build cp -v /go/bin/ctop /target/ + docker build -t ctop -f Dockerfile_minimal . + release: mkdir release go get github.com/progrium/gh-release/...