diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 1780f13348..3fb8351327 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -23,13 +23,13 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- + # - name: Cache Docker layers + # uses: actions/cache@v2 + # with: + # path: /tmp/.buildx-cache + # key: ${{ runner.os }}-buildx-${{ github.sha }} + # restore-keys: | + # ${{ runner.os }}-buildx- - name: Docker meta (controller) id: controller-meta @@ -87,8 +87,6 @@ jobs: platforms: ${{ steps.platform-matrix.outputs.platform-matrix }} push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.controller-meta.outputs.tags }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - name: Build and push (plugin-image) uses: docker/build-push-action@v2 @@ -97,13 +95,11 @@ jobs: platforms: ${{ steps.platform-matrix.outputs.platform-matrix }} push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.plugin-meta.outputs.tags }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 - - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache + # - name: Move cache + # run: | + # rm -rf /tmp/.buildx-cache + # mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/Dockerfile b/Dockerfile index c2ac9a90f6..be21aa3fa2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ # Initial stage which pulls prepares build dependencies and CLI tooling we need for our final image # Also used as the image in CI jobs so needs all dependencies #################################################################################################### -FROM golang:1.17.6 as builder +FROM --platform=$BUILDPLATFORM golang:1.17.6 as builder RUN apt-get update && apt-get install -y \ wget \ @@ -24,7 +24,7 @@ RUN cd ${GOPATH}/src/dummy && \ #################################################################################################### # UI build stage #################################################################################################### -FROM docker.io/library/node:12.18.4 as argo-rollouts-ui +FROM --platform=$BUILDPLATFORM docker.io/library/node:12.18.4 as argo-rollouts-ui WORKDIR /src ADD ["ui/package.json", "ui/yarn.lock", "./"] @@ -40,7 +40,7 @@ RUN NODE_ENV='production' yarn build #################################################################################################### # Rollout Controller Build stage which performs the actual build of argo-rollouts binaries #################################################################################################### -FROM golang:1.17.6 as argo-rollouts-build +FROM --platform=$BUILDPLATFORM golang:1.17.6 as argo-rollouts-build WORKDIR /go/src/github.com/argoproj/argo-rollouts @@ -61,8 +61,9 @@ RUN touch ui/dist/node_modules.marker && \ touch ui/dist/app/index.html && \ find ui/dist +ARG TARGETOS TARGETARCH ARG MAKE_TARGET="controller plugin plugin-linux plugin-darwin plugin-windows" -RUN make ${MAKE_TARGET} +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make ${MAKE_TARGET} #################################################################################################### # Kubectl plugin image