From 6a5fd4a1ca789dc242eb2dfeb6bbadeaf4509e43 Mon Sep 17 00:00:00 2001 From: zscholl Date: Fri, 9 Jul 2021 10:51:01 -0500 Subject: [PATCH 1/2] use scratch image --- Dockerfile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index a4bafe40..167699a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,14 @@ -FROM golang:1.14-alpine +FROM golang:alpine as builder +RUN apk --no-cache add ca-certificates WORKDIR /go/src/github.com/abutaha/aws-es-proxy COPY . . - RUN CGO_ENABLED=0 GOOS=linux go build -o aws-es-proxy -FROM alpine:3.11 -LABEL name="aws-es-proxy" \ - version="latest" - -RUN apk --no-cache add ca-certificates -WORKDIR /home/ -COPY --from=0 /go/src/github.com/abutaha/aws-es-proxy/aws-es-proxy /usr/local/bin/ +FROM scratch +COPY --from=builder /go/src/github.com/abutaha/aws-es-proxy/aws-es-proxy /usr/local/bin/ +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ ENV PORT_NUM 9200 EXPOSE ${PORT_NUM} From 3fc92e55ce2144691c6d2d82aea941bd3afc7a63 Mon Sep 17 00:00:00 2001 From: zscholl Date: Tue, 13 Jul 2021 07:42:53 -0500 Subject: [PATCH 2/2] add label --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 167699a3..9a54b910 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,8 @@ COPY . . RUN CGO_ENABLED=0 GOOS=linux go build -o aws-es-proxy FROM scratch +LABEL name="aws-es-proxy" \ + version="latest" COPY --from=builder /go/src/github.com/abutaha/aws-es-proxy/aws-es-proxy /usr/local/bin/ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/