From 78d89ee7cb2dae586fb694e3eb9675f7028b9155 Mon Sep 17 00:00:00 2001 From: Adam McElwee Date: Tue, 29 Mar 2022 10:28:58 -0600 Subject: [PATCH 1/3] Use multi-stage Dockerfile + distroless base Signed-off-by: Adam McElwee --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5d7e150..fee5080 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17-alpine +FROM golang:1.17-alpine as build RUN apk add --update --no-cache \ curl \ @@ -12,9 +12,12 @@ COPY . . RUN git rev-parse HEAD RUN date +%FT%T%z RUN make build -RUN cp ./bin/aws-auth /bin/aws-auth \ - && chmod +x /bin/aws-auth -ENV HOME /root +RUN chmod +x ./bin/aws-auth + +# Now copy it into our base image. +FROM gcr.io/distroless/base-debian11 +COPY --from=build /go/src/github.com/keikoproj/aws-auth/bin/aws-auth /bin/aws-auth +ENV HOME /root ENTRYPOINT ["/bin/aws-auth"] CMD ["help"] From 3fdbf776629dc6df7c7add8d8613e224c847e2d4 Mon Sep 17 00:00:00 2001 From: Adam McElwee Date: Tue, 29 Mar 2022 10:34:54 -0600 Subject: [PATCH 2/3] Switch to docker/metadata-action from crazy-max/ghaction-docker-meta Signed-off-by: Adam McElwee --- .github/workflows/push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 7a0c572..d1d1abd 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -38,7 +38,7 @@ jobs: - name: Docker meta id: docker_meta - uses: crazy-max/ghaction-docker-meta@v1 + uses: docker/metadata-action@v3 with: images: ${{ github.repository_owner }}/aws-auth From 986f0bc60b9cea3863daa0292988f4bc452c881f Mon Sep 17 00:00:00 2001 From: Adam McElwee Date: Tue, 29 Mar 2022 10:35:46 -0600 Subject: [PATCH 3/3] Add linux/arm64 docker build target Signed-off-by: Adam McElwee --- .github/workflows/push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index d1d1abd..d78cdf5 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -47,6 +47,6 @@ jobs: with: context: . file: ./Dockerfile - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.docker_meta.outputs.tags }}