Skip to content

Commit

Permalink
Merge pull request #238 from estesp/fix-alpine-dockerfile
Browse files Browse the repository at this point in the history
Allow better cross-compilation of added cred helpers
  • Loading branch information
estesp authored Nov 2, 2023
2 parents 47a9dea + 52bab1f commit 56b94e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions hack/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
FROM --platform=$TARGETARCH golang:1.21.3-alpine AS bld
FROM --platform=$BUILDPLATFORM golang:1.21.3-alpine AS bld
ARG TARGETPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
ARG BUILDPLATFORM
RUN apk add bash git

ENV GOOS linux
ENV GOARCH $TARGETARCH
ENV GOARMV $TARGETVARIANT
# Get GCR credential helper
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr@latest
RUN GOARM=${GOARMV#v} go install github.com/GoogleCloudPlatform/docker-credential-gcr@latest

# Get Amazon ECR credential helper
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest
RUN GOARM=${GOARMV#v} go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest

# Get ACR docker env credential helper
RUN go install github.com/chrismellard/docker-credential-acr-env@latest
RUN GOARM=${GOARMV#v} go install github.com/chrismellard/docker-credential-acr-env@latest

RUN mkdir /manifest-tool
WORKDIR /manifest-tool
COPY . /manifest-tool
RUN /manifest-tool/hack/makestatic.sh $TARGETARCH ${TARGETVARIANT#v}

FROM alpine:3.17.0
FROM --platform=$TARGETPLATFORM alpine:3.17.0
ARG TARGETARCH
COPY --from=bld /manifest-tool/manifest-tool /manifest-tool
COPY --from=bld /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=bld --chown=0:0 /go/bin/docker-credential-gcr /usr/bin/docker-credential-gcloud
COPY --from=bld --chown=0:0 /go/bin/docker-credential-ecr-login /usr/bin/docker-credential-ecr-login
COPY --from=bld --chown=0:0 /go/bin/docker-credential-acr-env /usr/bin/docker-credential-acr-env
COPY --from=bld --chown=0:0 /go/bin/linux_${TARGETARCH}/docker-credential-gcr /usr/bin/docker-credential-gcloud
COPY --from=bld --chown=0:0 /go/bin/linux_${TARGETARCH}/docker-credential-ecr-login /usr/bin/docker-credential-ecr-login
COPY --from=bld --chown=0:0 /go/bin/linux_${TARGETARCH}/docker-credential-acr-env /usr/bin/docker-credential-acr-env
ENV PATH="${PATH}:/"
ENTRYPOINT [ "/manifest-tool" ]
2 changes: 1 addition & 1 deletion v2/cmd/manifest-tool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var gitCommit = ""

const (
version = "2.1.0"
version = "2.1.1"
usage = "registry client to inspect and push multi-platform OCI & Docker v2 images"
)

Expand Down

0 comments on commit 56b94e8

Please sign in to comment.