diff --git a/.gitignore b/.gitignore index 39a93f7..6a204a9 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ captainhook .envrc dist/ cover +.idea/ diff --git a/Dockerfile.multi b/Dockerfile.multi new file mode 100644 index 0000000..cde457c --- /dev/null +++ b/Dockerfile.multi @@ -0,0 +1,24 @@ +FROM golang:1.10 as builder +ADD . /go/src/github.com/bketelsen/captainhook +WORKDIR /go/src/github.com/bketelsen/captainhook +RUN go get -u golang.org/x/vgo +RUN CGO_ENABLED=0 GOOS=linux vgo build -a -installsuffix cgo -o captainhook . + +FROM alpine:latest as alpine +RUN apk --no-cache add ca-certificates +WORKDIR /root/ +COPY --from=builder /go/src/github.com/bketelsen/captainhook/captainhook . + + +FROM scratch + +COPY --from=alpine /root/captainhook /usr/bin/captainhook +COPY --from=alpine /etc/ssl/certs/ /etc/ssl/certs + +VOLUME /config +ENTRYPOINT [ "/root/captainhook" ] +CMD ["/root/captainhook"] + + + + diff --git a/Makefile b/Makefile index 7a29e05..55b61bb 100644 --- a/Makefile +++ b/Makefile @@ -14,12 +14,12 @@ all: setup test build .PHONY: build build: setup @echo "Building..." - $Q vgo build $(if $V,-v) $(VERSION_FLAGS) + $Q go build $(if $V,-v) $(VERSION_FLAGS) .PHONY: dist dist: setup clean-dist @echo "Building Distribution..." - $Q vgo build $(if $V,-v) $(VERSION_FLAGS) -o $(dist_dir)/$(BINARY) $(IMPORT_PATH) + $Q go build $(if $V,-v) $(VERSION_FLAGS) -o $(dist_dir)/$(BINARY) $(IMPORT_PATH) .PHONY: clean-dist clean-dist: @@ -55,28 +55,28 @@ docker: clean: @echo "Clean..." - $Q rm -rf captainhook + $Q rm -rf $(BINARY) test: @echo "Testing..." - $Q vgo test $(if $V,-v) ./... + $Q go test $(if $V,-v) ./... ifndef CI @echo "Testing Outside CI..." - @echo "VGO Vet" - $Q vgo vet ./... - @echo "VGO test -race" - $Q GODEBUG=cgocheck=2 vgo test -race + @echo "GO Vet" + $Q go vet ./... + @echo "GO test -race" + $Q GODEBUG=cgocheck=2 go test -race else @echo "Testing in CI..." - $Q ( vgo vet ./...; echo $$? ) | \ + $Q ( go vet ./...; echo $$? ) | \ tee test/vet.txt | sed '$$ d'; exit $$(tail -1 test/vet.txt) - $Q ( GODEBUG=cgocheck=2 vgo test -v -race ./...; echo $$? ) | \ + $Q ( GODEBUG=cgocheck=2 go test -v -race ./...; echo $$? ) | \ tee test/output.txt | sed '$$ d'; exit $$(tail -1 test/output.txt) endif list: @echo "List..." - vgo list -m + go list -m format: $(GOIMPORTS) @@ -92,7 +92,6 @@ setup: clean if ! grep "dist" .gitignore > /dev/null 2>&1; then \ echo "dist" >> .gitignore; \ fi - go get -u golang.org/x/vgo go get -u rsc.io/goversion go get -u golang.org/x/tools/cmd/goimports