diff --git a/.gitignore b/.gitignore index cc6ce1de..2263aac8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,6 @@ *.o *.a *.so -*.swo -*.swp # Folders _obj diff --git a/Dockerfile b/Dockerfile index eda4d738..d62c2961 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:latest +FROM golang:alpine as builder MAINTAINER Jessica Frazelle ENV PATH /go/bin:/usr/local/go/bin:$PATH @@ -11,16 +11,20 @@ COPY . /go/src/github.com/jessfraz/reg RUN set -x \ && apk add --no-cache --virtual .build-deps \ - go \ git \ gcc \ libc-dev \ libgcc \ && cd /go/src/github.com/jessfraz/reg \ - && go build -o /usr/bin/reg . \ + && CGO_ENABLED=0 go build -a -tags netgo -ldflags '-extldflags "-static"' -o /usr/bin/reg . \ && apk del .build-deps \ && rm -rf /go \ && echo "Build complete." +FROM scratch + +COPY --from=builder /usr/bin/reg /usr/bin/reg +COPY --from=builder /etc/ssl/certs/ /etc/ssl/certs ENTRYPOINT [ "reg" ] +CMD [ "--help" ] diff --git a/LICENSE b/LICENSE index ce39057f..bbf14b80 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Jess Frazelle +Copyright (c) 2018 Jessica Frazelle Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/Makefile b/Makefile index 0bcf792d..7425a6b8 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,7 @@ staticcheck: ## Verifies `staticcheck` passes .PHONY: install install: ## Installs the executable or package @echo "+ $@" - @go install . + go install -a -tags "$(BUILDTAGS)" ${GO_LDFLAGS} . define buildpretty mkdir -p $(BUILDDIR)/$(1)/$(2);