From c1029c489511934df946a60b45b610360e539af6 Mon Sep 17 00:00:00 2001 From: moooofly Date: Wed, 4 Jul 2018 19:58:47 +0800 Subject: [PATCH] feat: add Dockerfile and 'make docker' sub-command --- Dockerfile | 12 ++++++++++++ Makefile | 3 +++ 2 files changed, 15 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..19def7e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM golang:1.9.0 as builder +WORKDIR /go/src/github.com/moooofly/harbor-go-client +COPY . . +RUN CGO_ENABLED=0 GOOS=linux go build -a + +# Final image. +FROM scratch +LABEL maintainer "moooofly " +COPY --from=builder /go/src/github.com/moooofly/harbor-go-client/harbor-go-client . +COPY conf /conf +ENTRYPOINT ["/harbor-go-client"] +CMD ["-h"] diff --git a/Makefile b/Makefile index 8cb3aa2..a5a3e00 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,9 @@ pack: build @echo "" @rm harbor-go-client +docker: + docker build -t harbor-go-client:$(shell git rev-parse --short HEAD) . + misspell: # misspell - requires that the following be run first: # go get -u github.com/client9/misspell/cmd/misspell