From 9a62862cbc209f89a2568857245d839e34340c72 Mon Sep 17 00:00:00 2001 From: Michiel Kalkman Date: Wed, 19 Dec 2018 08:36:47 +1100 Subject: [PATCH 1/3] Add Dockerfile for automated builds Signed-off-by: Michiel Kalkman --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9355790 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM golang:1.11-alpine as builder + +# Install our build tools + +RUN apk add --update git make curl bash +RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + +# Get sources + +RUN go get github.com/bloomberg/goldpinger/cmd/goldpinger +WORKDIR /go/src/github.com/bloomberg/goldpinger + +# Install our dependencies + +RUN make vendor + +# Build goldpinger + +RUN make bin/goldpinger + +# Build the asset container, copy over goldpinger + +FROM scratch +COPY --from=builder /go/src/github.com/bloomberg/goldpinger/bin/goldpinger /goldpinger +ENTRYPOINT ["/goldpinger", "--static-file-path", "/static"] + From 4bdda1f6be8e51e755ccf4030ed567bb3b311023 Mon Sep 17 00:00:00 2001 From: Michiel Kalkman Date: Wed, 19 Dec 2018 10:25:02 +1100 Subject: [PATCH 2/3] Remove unnecessary pkg installation, add static - Remove curl installation - Change dep installation from 'curl' to 'go get' - Copy static content to asset container Signed-off-by: Michiel Kalkman --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9355790..172d27d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ FROM golang:1.11-alpine as builder # Install our build tools -RUN apk add --update git make curl bash -RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh +RUN apk add --update git make +RUN go get -u github.com/golang/dep/cmd/dep # Get sources @@ -16,11 +16,13 @@ RUN make vendor # Build goldpinger +RUN apk add bash RUN make bin/goldpinger # Build the asset container, copy over goldpinger FROM scratch COPY --from=builder /go/src/github.com/bloomberg/goldpinger/bin/goldpinger /goldpinger +COPY ./static /static ENTRYPOINT ["/goldpinger", "--static-file-path", "/static"] From a00da77b2c8769fdba4c77a5f711b23b776f6b81 Mon Sep 17 00:00:00 2001 From: Michiel Kalkman Date: Wed, 19 Dec 2018 21:43:22 +1100 Subject: [PATCH 3/3] Run 'apk add' once for all required packages Signed-off-by: Michiel Kalkman --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 172d27d..7e38d28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.11-alpine as builder # Install our build tools -RUN apk add --update git make +RUN apk add --update git make bash RUN go get -u github.com/golang/dep/cmd/dep # Get sources @@ -16,7 +16,6 @@ RUN make vendor # Build goldpinger -RUN apk add bash RUN make bin/goldpinger # Build the asset container, copy over goldpinger