GithubHelp home page GithubHelp logo

crazy-max / ghaction-docker-buildx Goto Github PK

View Code? Open in Web Editor NEW
226.0 6.0 17.0 13.44 MB

:octocat: GitHub Action to set up Docker Buildx

Home Page: https://github.com/marketplace/actions/docker-buildx

License: MIT License

TypeScript 93.65% Dockerfile 2.79% JavaScript 3.56%
github-actions docker buildx actions

ghaction-docker-buildx's Introduction

GitHub release GitHub marketplace Test workflow Codecov Become a sponsor Paypal Donate

Moved to Docker organization

This action is ARCHIVED and will not receive any updates, update your workflows to use the official Docker actions.

Replace

      - name: Set up Docker Buildx
        uses: crazy-max/ghaction-docker-buildx@v3

With

      # https://github.com/docker/setup-qemu-action
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      # https://github.com/docker/setup-buildx-action
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

About

GitHub Action to set up Docker Buildx.

If you are interested, check out my other :octocat: GitHub Actions!

GitHub Action to set up Docker Buildx


Usage

Quick start

Here is a simple example to build a Docker image with buildx (BuildKit)

name: buildx

on:
  pull_request:
    branches: master
  push:
    branches: master
    tags:

jobs:
  buildx:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Set up Docker Buildx
        id: buildx
        uses: crazy-max/ghaction-docker-buildx@v3
        with:
          buildx-version: latest
          qemu-version: latest
      -
        name: Available platforms
        run: echo ${{ steps.buildx.outputs.platforms }}
      -
        name: Run Buildx
        run: |
          docker buildx build \
            --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x \
            --output "type=image,push=false" \
            --file ./test/Dockerfile ./test

Build and push to DockerHub

Another example to build and push Diun Docker image on DockerHub.

  • On push event, Docker image crazymax/diun:edge is built and pushed on DockerHub.
  • On pull_request event, Docker image crazymax/diun:edge is built.
  • On schedule event, Docker image crazymax/diun:nightly is built and pushed on DockerHub.
  • On push tags event, Docker image crazymax/diun:<version> and crazymax/diun:latest is built and pushed on DockerHub.
name: buildx

on:
  schedule:
    - cron: '0 10 * * *' # everyday at 10am
  pull_request:
    branches: master
  push:
    branches: master
    tags:
      - v*

jobs:
  buildx:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Prepare
        id: prepare
        run: |
          DOCKER_IMAGE=crazymax/diun
          DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
          VERSION=edge

          if [[ $GITHUB_REF == refs/tags/* ]]; then
            VERSION=${GITHUB_REF#refs/tags/v}
          fi
          if [ "${{ github.event_name }}" = "schedule" ]; then
            VERSION=nightly
          fi

          TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
          if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
            TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest"
          fi

          echo ::set-output name=docker_image::${DOCKER_IMAGE}
          echo ::set-output name=version::${VERSION}
          echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
            --build-arg VERSION=${VERSION} \
            --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
            --build-arg VCS_REF=${GITHUB_SHA::8} \
            ${TAGS} --file ./test/Dockerfile ./test
      -
        name: Set up Docker Buildx
        uses: crazy-max/ghaction-docker-buildx@v3
      -
        name: Docker Buildx (build)
        run: |
          docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
      -
        name: Login to DockerHub
        if: success() && github.event_name != 'pull_request'
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
      -
        name: Docker Buildx (push)
        if: success() && github.event_name != 'pull_request'
        run: |
          docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
      -
        name: Inspect image
        if: always() && github.event_name != 'pull_request'
        run: |
          docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}

Leverage buildx cache

You can leverage cache using @actions/cache with this action.

name: buildx

on:
  pull_request:
    branches: master
  push:
    branches: master

jobs:
  buildx:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Set up Docker Buildx
        uses: crazy-max/ghaction-docker-buildx@v3
      -
        name: Cache Docker layers
        uses: actions/cache@v2
        id: cache
        with:
          path: /tmp/.buildx-cache
          key: ${{ runner.os }}-buildx-${{ github.sha }}
          restore-keys: |
            ${{ runner.os }}-buildx-
      -
        name: Docker Buildx (build)
        run: |
          docker buildx build \
            --cache-from "type=local,src=/tmp/.buildx-cache" \
            --cache-to "type=local,dest=/tmp/.buildx-cache" \
            --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x \
            --output "type=image,push=false" \
            --tag crazymax/diun:latest \
            --file ./Dockerfile-diun ./
      -
        name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
      -
        name: Docker Buildx (push)
        run: |
          docker buildx build \
            --cache-from "type=local,src=/tmp/.buildx-cache" \
            --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x \
            --output "type=image,push=true" \
            --tag crazymax/diun:latest \
            --file ./Dockerfile-diun ./
      -
        name: Inspect image
        run: |
          docker buildx imagetools inspect crazymax/diun:latest

Projects using this action

Customizing

inputs

Following inputs can be used as step.with keys

Name Type Default Description
buildx-version String latest Buildx version. Example: v0.3.0
qemu-version String latest qemu-user-static version (Docker tag). Example: 4.2.0-7

outputs

Following outputs are available

Name Type Description
platforms String Available platforms (comma separated)

environment variables

The following official docker environment variables are supported:

Name Type Default Description
DOCKER_CONFIG String ~/.docker The location of your client configuration files

Keep up-to-date with GitHub Dependabot

Since Dependabot has native GitHub Actions support, to enable it on your GitHub repo all you need to do is add the .github/dependabot.yml file:

version: 2
updates:
  # Maintain dependencies for GitHub Actions
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "daily"

Limitation

This action is only available for Linux virtual environments.

How can I help?

All kinds of contributions are welcome 🙌! The most basic way to show your support is to star 🌟 the project, or to raise issues 💬 You can also support this project by becoming a sponsor on GitHub 👏 or by making a Paypal donation to ensure this journey continues indefinitely! 🚀

Thanks again for your support, it is much appreciated! 🙏

License

MIT. See LICENSE for more details.

ghaction-docker-buildx's People

Contributors

crazy-max avatar dependabot-preview[bot] avatar dependabot[bot] avatar fhuitelec avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ghaction-docker-buildx's Issues

Invalid syntax

Hi, first of all thanks for this great Github action.
I'm using it to build a Docker image on different architectures and since yesterday (Apr 29) everything run smoothly.

With today's builds I'm having the following error:

invalid argument "--push" for "--no-cache" flag: strconv.ParseBool: parsing "--push": invalid syntax

The command is the following:

docker buildx build --platform linux/ppc64le,linux/s390x,linux/arm/v7,linux/arm64 -t instathings/gate:staging --file ./Dockerfile --no-cache --push ./

Can you help me on this?
Thank you

Claudio

sample for adding label to image

Could you provide a sample for adding labels for the image for faciliate the client side to 'docker inspect xxx:yyy' to checking the detail info in image.

I've tried appending --label as:


        echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
            --build-arg VERSION=${VERSION} \
            --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
            --build-arg VCS_REF=${GITHUB_SHA::8} \
            --label lastCommitMessage="${{ github.event.head_commit.message }}" \         
            --label lastCommitSHA="${GITHUB_SHA}" \
            --label GITHUB_REF="${GITHUB_REF}" \
            ${TAGS} --file ./Dockerfile ./

but always got a build error that:

--label: command not found

How to push to DockerHub

Hello, I'm using your action to build my image to several architecure. I would like to know how can I then push the built image to dockerhub ?

Thank you

sudo inside dockerfile cause error "sudo: effective uid is not 0" for arm platform

Behaviour

Trying to build container with command RUN sudo not from root user causes error

#12 [ 9/11] RUN sudo chown -R rust:rust /app
#12 0.119 sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
#12 ERROR: executor failed running [/bin/sh -c sudo chown -R rust:rust /app]: buildkit-runc did not terminate successfully

Steps to reproduce this issue

  1. set action with crazy-max/ghaction-docker-buildx@v2
  2. run buildx action for arm platform
docker buildx build \
            --platform linux/arm64 \
            --build-arg RUST_TARGET=aarch64-unknown-linux-musl \
            --progress plain \
            --load .

inside build script set user to non root with right do sudo, and run sudo:

USER rust
RUN sudo chown -R rust:rust /app

Expected behaviour

just work, as on my laptop

Actual behaviour

error

#12 [ 9/11] RUN sudo chown -R rust:rust /app
#12 0.119 sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
#12 ERROR: executor failed running [/bin/sh -c sudo chown -R rust:rust /app]: buildkit-runc did not terminate successfully

Configuration

paste your YAML workflow file here and remove sensitive data

https://github.com/iav/test3/blob/master/.github/workflows/main.yml

dockerfile: https://github.com/iav/test3/blob/master/Dockerfile

Logs

Download the log file of your build and attach it to this issue.

How can i use multiple dockerfiles for different platforms?

Hi @crazy-max

Thanks for this awesome action!

This might be a buildx specific query but if you could offer any insight it will be greatly appreciated.

I have added multi-platform package support based on your repo ddns-route53 using this action.

I noticed that your Dockerfile sets the platform before pulling the base image to compile/package your application.

FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.13.5-alpine as builder

My application is a ASP Net Core application running on dotnet core 3.1 - It appears that Microsoft offers their image platforms based on different tags microsoft-dotnet-core-runtime.

Is there anyway i can specify multiple docker files for each platform in buildx using your action?

Dockerfile.debian-arm32
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim-arm32v7

Dockerfile
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1

At the moment i am getting the error below due to docker not finding a target platform in Microsofts dotnet core SDK image.

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build

https://github.com/SeanoNET/RoomTempDashboard/runs/436004074?check_suite_focus=true

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: no match for platform in manifest sha256:f4798993581a660740f06bdc126cf8258788a67518fb43e4275ecc6d4b226211: not found

Conflicts with azure/docker-login

Behaviour

Steps to reproduce this issue

Create a pipeline which uses both azure/docker-login and ghaction-docker-buildx.

If azure/docker-login precedes ghaction-docker-buildx then the latter will fail. If not then docker buildx build will fail.

Expected behaviour

It completes successfully

Actual behaviour

It fails.

Configuration

  • Repository URL (if public): n/a
  • Build URL (if public): n/a
name: example

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    name: build
    runs-on: ubuntu-latest
    steps:
      - name: checkout code
        uses: actions/checkout@v1

      - uses: azure/docker-login@v1
        with:
          username: ${{ secrets.DOCKER_USER }}
          password: ${{ secrets.DOCKER_PASS }}

      - name: Set up Docker Buildx
        uses: crazy-max/ghaction-docker-buildx@v3

[Q] How can I apply a workaround for "32bit build within a 64bit host using qemu"?

There are a but "32bit build within a 64bit host using qemu".
More details and workaround here uraimo/run-on-arch-action#9, rust-lang/cargo#7451https://lkml.org/lkml/2018/12/28/461

In my case I need to have a rust builder container for armv7 target have tmpfs or other 32/64 bit error-free fs for /usr/local/cargo/registry and, maybe, /root/.cargo/ folders.

I it possible to apply something like

mkdir ~/.cargo
mount -t tmpfs -o size=2048m tmpfs ~/.cargo

for all builder container?

EXDEV: cross-device link not permitted

Behaviour

Github action raises this error while downloading buildx:

The process '/usr/bin/docker' failed with exit code 1
EXDEV: cross-device link not permitted, rename '/home/runner/work/_temp/532e6f7e-b2c0-40e6-8d63-762f9b51fed2' -> '/home/runner/.docker/cli-plugins/docker-buildx'

Steps to reproduce this issue

See https://github.com/prise6/medias-trends/runs/693432032

Configuration

name: Docker image

on:
  release:
    types: [published]
  push:
    branches:
      - dev-docker

env:
  IMAGE_NAME: prise6/mediastrends

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python 3.7
        uses: actions/setup-python@v2
        with:
          python-version: 3.7
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install setuptools wheel
      - name: Build python package
        run: |
          python setup.py sdist bdist_wheel
      - name: Upload python wheel 
        uses: actions/upload-artifact@v2
        with:
          name: mediastrends_wheel
          path: dist/*.whl

  docker-deploy:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: actions/checkout@v2
      - name: Create dist directory
        run: |
          mkdir dist
      - name: Download python wheel package
        uses: actions/download-artifact@v2
        with:
          name: mediastrends_wheel
          path: dist
      - name: Build docker image
        if: github.event_name == 'release'
        uses: docker/build-push-action@v1
        with:
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
          registry: docker.pkg.github.com
          repository: prise6/medias-trends/mediastrends-core
          tag_with_ref: True
      - name: Set up Docker Buildx
        uses: crazy-max/ghaction-docker-buildx@v1
        with:
          version: latest
      - name: Login dockerhub
        run: |
          echo "${{ secrets.DOCKER_PASSWORD }}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin
      - name: Build docker image with buildx
        run: |

          # Strip git ref prefix from version
          VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
          # Strip "v" prefix from tag name
          [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
          # Use Docker `latest` tag convention
          [ "$VERSION" == "master" ] && VERSION=latest

          echo $IMAGE_NAME:$VERSION

          docker buildx build \
            --platform linux/amd64,linux/arm/v7 \
            --push \
            --tag $IMAGE_NAME:$VERSION \
            --file Dockerfile .
      - name: Clear
        run: |
          rm -f ${HOME}/.docker/config.json

Logs

logs_99.zip

Getting 403 response from GitHub

I'm using this on several projects and they all started doing this just today:

Run crazy-max/[email protected]
✅ Buildx version found: v0.4.1
⬇️ Downloading https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64...
##[error]Unexpected HTTP response: 403

The yaml for that step is pretty vanilla:

    - name: Set up Docker Buildx
      id: buildx
      uses: crazy-max/[email protected]
      with:
        buildx-version: latest
        qemu-version: latest

I just updated to 1.6.0 today, it's also broken on 1.4.0 which is what I was using before.

Asking a sample for adding label to image

Behaviour

Could not labling the image

Steps to reproduce this issue

follow the repo's readme doc, I can successfully build and push a image to registry, but when doing docker inspect myimage:xyz, I didn't see any label info.

Expected behaviour

can labeling the image when doing the build.

Actual behaviour

I've tried appending --label as:


        echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
            --build-arg VERSION=${VERSION} \
            --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
            --build-arg VCS_REF=${GITHUB_SHA::8} \
            --label lastCommitMessage="${{ github.event.head_commit.message }}" \         
            --label lastCommitSHA="${GITHUB_SHA}" \
            --label GITHUB_REF="${GITHUB_REF}" \
            ${TAGS} --file ./Dockerfile ./

but always got a build error that:

--label: command not found

Configuration

  • Repository URL (if public):
  • Build URL (if public):
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
            --build-arg VERSION=${VERSION} \
            --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
            --build-arg VCS_REF=${GITHUB_SHA::8} \
            --label lastCommitMessage="${{ github.event.head_commit.message }}" \         
            --label lastCommitSHA="${GITHUB_SHA}" \
            --label GITHUB_REF="${GITHUB_REF}" \
            ${TAGS} --file ./Dockerfile ./

Logs

--label: command not found

Question: Cache

I saw your comment here

Screenshot from 2020-01-19 15-12-27

I'm curious about this. How would it be possible? Cache generated while building docker images should not be necessarily persisted in the same physical machine? (Maybe that's because I don't know buildkit or buildx well)

And what do you mean by does not require to push to registry, more concretely?

Regardless of the answer, thank you for making this action!

Thank you!

Hi,
I just wanted to say thank you for this project. We started using GitHub actions recently and needed a way to use docker buildx. You project has made it very easy for us to use docker buildx in GitHub actions. It is working great!

-Tamal

The qemu-version input is not getting used

Behaviour

The qemu-version input is not getting used while installing QEMU static binaries. It always create qemu-user-static container with latest tag.

Steps to reproduce this issue

  1. Specify the qemu-version input in crazy-max/ghaction-docker-buildx GitHub Action:
    - name: Docker Buildx
      uses: crazy-max/ghaction-docker-buildx@v3
      with:
        buildx-version: v0.4.1
        qemu-version: 4.2.0-7
  1. Execute the build

Expected behaviour

This should run following command to install QEMU static binaries:
/usr/bin/docker run --rm --privileged multiarch/qemu-user-static:4.2.0-7 --reset -p yes --credential yes

Actual behaviour

Though it pulls the docker image for multiarch/qemu-user-static:4.2.0-7, it still tries to find image with latest tag and pulls it for running docker container:

💎 Installing QEMU static binaries...
/usr/bin/docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes
Unable to find image 'multiarch/qemu-user-static:latest' locally
latest: Pulling from multiarch/qemu-user-static

Logs

Run crazy-max/ghaction-docker-buildx@v3
⬇️ Downloading https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64...
🔨 Fixing perms...
📣 Buildx info
/usr/bin/docker buildx version
github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c
⬇️ Downloading qemu-user-static Docker image...
/usr/bin/docker pull -q multiarch/qemu-user-static:4.2.0-7
docker.io/multiarch/qemu-user-static:4.2.0-7
💎 Installing QEMU static binaries...
/usr/bin/docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes
Unable to find image 'multiarch/qemu-user-static:latest' locally
latest: Pulling from multiarch/qemu-user-static
d9cbbca60e5f: Already exists
c5351f770467: Pulling fs layer
.
.
.
6cbaefe2d3dc: Download complete
6cbaefe2d3dc: Pull complete
Digest: sha256:96c2efd64db20bc326788773f6fa7cecef71b9d2c3de4c7d95a9910f38295c42
Status: Downloaded newer image for multiarch/qemu-user-static:latest
Setting /usr/bin/qemu-alpha-static as binfmt interpreter for alpha
Setting /usr/bin/qemu-arm-static as binfmt interpreter for arm

What am i doing wrong??

I keep getting multiple errors in relation to my buildx execution - It's crashing when pulling bionic and I'm not sure what I'm doing wrong... Is this related to the new "ubuntu_latest" image?

I seem to be getting error code 1 when booting buildkit and then several timeout/rpc errors

I'm running the following - Basically I'm using buildx to initially build an AMD64 image, load it to local registry/images, start the container locally, run some CI testing and if those pass then re-run buildx to build the ARMv7 and ARM64 images pushing them to Docker Hub. The first step of building the AMD64 image fails...

      - name: Set up Docker Buildx
        id: buildx
        uses: crazy-max/ghaction-docker-buildx@master
        with:
          buildx-version: latest
          qemu-version: latest

      - name: Available Docker Buildx platforms
        run: echo ${{ steps.buildx.outputs.platforms }}

      - name: Docker Buildx and load x86 image to Docker images
        run: |
          docker buildx build \
            --platform linux/amd64 \
            --tag rhastie/nmos-cpp:dev \
            --build-arg makemt=3 \
            --load \
            --file ./Dockerfile .

Please can anyone advise or assist? I know its me but any guidance would be appreciated...

My log is below with the command chain...

2020-05-20T20:02:47.6016783Z ##[group]Run crazy-max/ghaction-docker-buildx@master
2020-05-20T20:02:47.6017006Z with:
2020-05-20T20:02:47.6017173Z   buildx-version: latest
2020-05-20T20:02:47.6017333Z   qemu-version: latest
2020-05-20T20:02:47.6017485Z env:
2020-05-20T20:02:47.6018764Z   SECRET_GOOGLE_CREDENTIALS: ***
2020-05-20T20:02:47.6018984Z   SECRET_RESULTS_SHEET_ID: ***
2020-05-20T20:02:47.6019154Z   GITHUB_COMMIT: 1b067ed
2020-05-20T20:02:47.6019313Z   GITHUB_BRANCH: dev
2020-05-20T20:02:47.6019484Z   GITHUB_WORKSPACE: /home/runner/work/build-nmos-cpp/build-nmos-cpp
2020-05-20T20:02:47.6019672Z   RUNNER_WORKSPACE: /home/runner/work/build-nmos-cpp
2020-05-20T20:02:47.6019880Z   BUILD_NAME: ubuntu-latest_avahi
2020-05-20T20:02:47.6020041Z   TEST_FAIL: FALSE
2020-05-20T20:02:47.6020215Z   GDRIVE_CREDENTIALS: /home/runner/work/build-nmos-cpp/build-nmos-cpp/gdrive/credentials.json
2020-05-20T20:02:47.6020418Z   HOST_IP_ADDRESS: 10.1.0.4
2020-05-20T20:02:47.6020561Z ##[endgroup]
2020-05-20T20:02:47.8966329Z ✅ Buildx version found: v0.4.1
2020-05-20T20:02:47.8974939Z ⬇� Downloading https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64...
2020-05-20T20:02:48.7224749Z 🔨 Fixing perms...
2020-05-20T20:02:48.7225884Z 📣 Buildx info
2020-05-20T20:02:48.7253663Z [command]/usr/bin/docker buildx version
2020-05-20T20:02:49.2835782Z github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c
2020-05-20T20:02:49.2931300Z ⬇� Downloading qemu-user-static Docker image...
2020-05-20T20:02:49.2953721Z [command]/usr/bin/docker pull -q multiarch/qemu-user-static:latest
2020-05-20T20:02:51.3175798Z docker.io/multiarch/qemu-user-static:latest
2020-05-20T20:02:51.3197597Z 💎 Installing QEMU static binaries...
2020-05-20T20:02:51.3210354Z [command]/usr/bin/docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
2020-05-20T20:02:56.0464101Z Setting /usr/bin/qemu-alpha-static as binfmt interpreter for alpha
2020-05-20T20:02:56.0467324Z Setting /usr/bin/qemu-arm-static as binfmt interpreter for arm
2020-05-20T20:02:56.0474021Z Setting /usr/bin/qemu-armeb-static as binfmt interpreter for armeb
2020-05-20T20:02:56.0479726Z Setting /usr/bin/qemu-sparc-static as binfmt interpreter for sparc
2020-05-20T20:02:56.0492358Z Setting /usr/bin/qemu-sparc32plus-static as binfmt interpreter for sparc32plus
2020-05-20T20:02:56.0505639Z Setting /usr/bin/qemu-sparc64-static as binfmt interpreter for sparc64
2020-05-20T20:02:56.0536104Z Setting /usr/bin/qemu-ppc-static as binfmt interpreter for ppc
2020-05-20T20:02:56.0570633Z Setting /usr/bin/qemu-ppc64-static as binfmt interpreter for ppc64
2020-05-20T20:02:56.0578148Z Setting /usr/bin/qemu-ppc64le-static as binfmt interpreter for ppc64le
2020-05-20T20:02:56.0585433Z Setting /usr/bin/qemu-m68k-static as binfmt interpreter for m68k
2020-05-20T20:02:56.0586388Z Setting /usr/bin/qemu-mips-static as binfmt interpreter for mips
2020-05-20T20:02:56.0587226Z Setting /usr/bin/qemu-mipsel-static as binfmt interpreter for mipsel
2020-05-20T20:02:56.0627556Z Setting /usr/bin/qemu-mipsn32-static as binfmt interpreter for mipsn32
2020-05-20T20:02:56.0632246Z Setting /usr/bin/qemu-mipsn32el-static as binfmt interpreter for mipsn32el
2020-05-20T20:02:56.0633193Z Setting /usr/bin/qemu-mips64-static as binfmt interpreter for mips64
2020-05-20T20:02:56.0663162Z Setting /usr/bin/qemu-mips64el-static as binfmt interpreter for mips64el
2020-05-20T20:02:56.0666676Z Setting /usr/bin/qemu-sh4-static as binfmt interpreter for sh4
2020-05-20T20:02:56.0667980Z Setting /usr/bin/qemu-sh4eb-static as binfmt interpreter for sh4eb
2020-05-20T20:02:56.0669748Z Setting /usr/bin/qemu-s390x-static as binfmt interpreter for s390x
2020-05-20T20:02:56.0670444Z Setting /usr/bin/qemu-aarch64-static as binfmt interpreter for aarch64
2020-05-20T20:02:56.0681545Z Setting /usr/bin/qemu-aarch64_be-static as binfmt interpreter for aarch64_be
2020-05-20T20:02:56.0687877Z Setting /usr/bin/qemu-hppa-static as binfmt interpreter for hppa
2020-05-20T20:02:56.0702351Z Setting /usr/bin/qemu-riscv32-static as binfmt interpreter for riscv32
2020-05-20T20:02:56.0715014Z Setting /usr/bin/qemu-riscv64-static as binfmt interpreter for riscv64
2020-05-20T20:02:56.0726817Z Setting /usr/bin/qemu-xtensa-static as binfmt interpreter for xtensa
2020-05-20T20:02:56.0737895Z Setting /usr/bin/qemu-xtensaeb-static as binfmt interpreter for xtensaeb
2020-05-20T20:02:56.0749417Z Setting /usr/bin/qemu-microblaze-static as binfmt interpreter for microblaze
2020-05-20T20:02:56.0760442Z Setting /usr/bin/qemu-microblazeel-static as binfmt interpreter for microblazeel
2020-05-20T20:02:56.0772336Z Setting /usr/bin/qemu-or1k-static as binfmt interpreter for or1k
2020-05-20T20:02:56.2455502Z 🔨 Creating a new builder instance...
2020-05-20T20:02:56.2473135Z [command]/usr/bin/docker buildx create --name builder-1b067eda288ff81cb32bc275748c8e6df10cd13a --driver docker-container --use
2020-05-20T20:02:56.4258660Z builder-1b067eda288ff81cb32bc275748c8e6df10cd13a
2020-05-20T20:02:56.4279425Z � Booting builder...
2020-05-20T20:02:56.4292161Z [command]/usr/bin/docker buildx inspect --bootstrap
2020-05-20T20:02:56.4866186Z #1 [internal] booting buildkit
2020-05-20T20:02:56.6373523Z #1 pulling image moby/buildkit:buildx-stable-1
2020-05-20T20:02:57.9886098Z #1 pulling image moby/buildkit:buildx-stable-1 1.4s done
2020-05-20T20:02:57.9886713Z #1 creating container buildx_buildkit_builder-1b067eda288ff81cb32bc275748c8e6df10cd13a0
2020-05-20T20:03:02.4287583Z #1 creating container buildx_buildkit_builder-1b067eda288ff81cb32bc275748c8e6df10cd13a0 4.6s done
2020-05-20T20:03:02.4287919Z #1 ERROR: exit code 1
2020-05-20T20:03:02.4288228Z ------
2020-05-20T20:03:02.4288406Z  > [internal] booting buildkit:
2020-05-20T20:03:02.4288690Z ------
2020-05-20T20:03:02.4794902Z error: dial unix /run/buildkit/buildkitd.sock: connect: no such file or directory
2020-05-20T20:03:22.4322824Z Name:   builder-1b067eda288ff81cb32bc275748c8e6df10cd13a
2020-05-20T20:03:22.4323218Z Driver: docker-container
2020-05-20T20:03:22.4323299Z 
2020-05-20T20:03:22.4323465Z Nodes:
2020-05-20T20:03:22.4323853Z Name:     builder-1b067eda288ff81cb32bc275748c8e6df10cd13a0
2020-05-20T20:03:22.4324390Z Endpoint: unix:///var/run/docker.sock
2020-05-20T20:03:22.4324614Z Error:    listing workers: failed to list workers: rpc error: code = Unavailable desc = timed out waiting for server handshake
2020-05-20T20:03:22.4345806Z � Docker info
2020-05-20T20:03:22.4362136Z [command]/usr/bin/docker info
2020-05-20T20:03:22.5417630Z Client:
2020-05-20T20:03:22.5418937Z  Debug Mode: false
2020-05-20T20:03:22.5419278Z  Plugins:
2020-05-20T20:03:22.5419566Z   buildx: Build with BuildKit (Docker Inc., v0.4.1)
2020-05-20T20:03:22.5420323Z 
2020-05-20T20:03:22.5420638Z Server:
2020-05-20T20:03:22.5421002Z  Containers: 1
2020-05-20T20:03:22.5421974Z   Running: 1
2020-05-20T20:03:22.5422259Z   Paused: 0
2020-05-20T20:03:22.5422589Z   Stopped: 0
2020-05-20T20:03:22.5422892Z  Images: 16
2020-05-20T20:03:22.5423169Z  Server Version: 3.0.11+azure
2020-05-20T20:03:22.5423487Z  Storage Driver: overlay2
2020-05-20T20:03:22.5423871Z   Backing Filesystem: <unknown>
2020-05-20T20:03:22.5424163Z   Supports d_type: true
2020-05-20T20:03:22.5424466Z   Native Overlay Diff: false
2020-05-20T20:03:22.5425352Z  Logging Driver: json-file
2020-05-20T20:03:22.5425652Z  Cgroup Driver: cgroupfs
2020-05-20T20:03:22.5425927Z  Plugins:
2020-05-20T20:03:22.5426222Z   Volume: local
2020-05-20T20:03:22.5426539Z   Network: bridge host ipvlan macvlan null overlay
2020-05-20T20:03:22.5427068Z   Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
2020-05-20T20:03:22.5447509Z  Swarm: inactive
2020-05-20T20:03:22.5447773Z  Runtimes: runc
2020-05-20T20:03:22.5447949Z  Default Runtime: runc
2020-05-20T20:03:22.5448559Z  Init Binary: docker-init
2020-05-20T20:03:22.5448752Z  containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
2020-05-20T20:03:22.5448943Z  runc version: 
2020-05-20T20:03:22.5449208Z  init version: fec3683
2020-05-20T20:03:22.5449384Z  Security Options:
2020-05-20T20:03:22.5449550Z   apparmor
2020-05-20T20:03:22.5450048Z   seccomp
2020-05-20T20:03:22.5450223Z    Profile: default
2020-05-20T20:03:22.5450594Z  Kernel Version: 5.3.0-1020-azure
2020-05-20T20:03:22.5450775Z  Operating System: Ubuntu 18.04.4 LTS
2020-05-20T20:03:22.5451871Z  OSType: linux
2020-05-20T20:03:22.5452086Z  Architecture: x86_64
2020-05-20T20:03:22.5770082Z  CPUs: 2
2020-05-20T20:03:22.5770794Z  Total Memory: 6.765GiB
2020-05-20T20:03:22.5771537Z  Name: fv-az55
2020-05-20T20:03:22.5862490Z  ID: CVBH:LCU3:H25P:G3X2:KBBX:D2QY:G3BL:ZI5B:ISCZ:OAZM:BOKC:XTZA
2020-05-20T20:03:22.5863596Z  Docker Root Dir: /var/lib/docker
2020-05-20T20:03:22.5864037Z  Debug Mode: false
2020-05-20T20:03:22.5864716Z  Registry: https://index.docker.io/v1/
2020-05-20T20:03:22.5865132Z  Labels:
2020-05-20T20:03:22.5866372Z  Experimental: false
2020-05-20T20:03:22.5866729Z  Insecure Registries:
2020-05-20T20:03:22.6058938Z   127.0.0.0/8
2020-05-20T20:03:22.6099010Z  Live Restore Enabled: false
2020-05-20T20:03:22.6099305Z 
2020-05-20T20:03:22.6100289Z 🛒 Extracting available platforms...
2020-05-20T20:03:22.7232754Z ##[group]Run echo linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
2020-05-20T20:03:22.7233026Z �[36;1mecho linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6�[0m
2020-05-20T20:03:22.7299061Z shell: /bin/bash -e {0}
2020-05-20T20:03:22.7299207Z env:
2020-05-20T20:03:22.7300939Z   SECRET_GOOGLE_CREDENTIALS: ***
2020-05-20T20:03:22.7301141Z   SECRET_RESULTS_SHEET_ID: ***
2020-05-20T20:03:22.7301287Z   GITHUB_COMMIT: 1b067ed
2020-05-20T20:03:22.7301422Z   GITHUB_BRANCH: dev
2020-05-20T20:03:22.7301570Z   GITHUB_WORKSPACE: /home/runner/work/build-nmos-cpp/build-nmos-cpp
2020-05-20T20:03:22.7301735Z   RUNNER_WORKSPACE: /home/runner/work/build-nmos-cpp
2020-05-20T20:03:22.7301885Z   BUILD_NAME: ubuntu-latest_avahi
2020-05-20T20:03:22.7302024Z   TEST_FAIL: FALSE
2020-05-20T20:03:22.7302181Z   GDRIVE_CREDENTIALS: /home/runner/work/build-nmos-cpp/build-nmos-cpp/gdrive/credentials.json
2020-05-20T20:03:22.7302399Z   HOST_IP_ADDRESS: 10.1.0.4
2020-05-20T20:03:22.7302670Z ##[endgroup]
2020-05-20T20:03:22.7390603Z linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
2020-05-20T20:03:22.7420174Z ##[group]Run docker buildx build \
2020-05-20T20:03:22.7420427Z �[36;1mdocker buildx build \�[0m
2020-05-20T20:03:22.7420575Z �[36;1m  --platform linux/amd64 \�[0m
2020-05-20T20:03:22.7420814Z �[36;1m  --tag ***/nmos-cpp:dev \�[0m
2020-05-20T20:03:22.7420958Z �[36;1m  --build-arg makemt=3 \�[0m
2020-05-20T20:03:22.7421100Z �[36;1m  --load \�[0m
2020-05-20T20:03:22.7421238Z �[36;1m  --file ./Dockerfile .�[0m
2020-05-20T20:03:22.7462083Z shell: /bin/bash -e {0}
2020-05-20T20:03:22.7462236Z env:
2020-05-20T20:03:22.7463438Z   SECRET_GOOGLE_CREDENTIALS: ***
2020-05-20T20:03:22.7463635Z   SECRET_RESULTS_SHEET_ID: ***
2020-05-20T20:03:22.7463791Z   GITHUB_COMMIT: 1b067ed
2020-05-20T20:03:22.7463931Z   GITHUB_BRANCH: dev
2020-05-20T20:03:22.7464082Z   GITHUB_WORKSPACE: /home/runner/work/build-nmos-cpp/build-nmos-cpp
2020-05-20T20:03:22.7464739Z   RUNNER_WORKSPACE: /home/runner/work/build-nmos-cpp
2020-05-20T20:03:22.7464902Z   BUILD_NAME: ubuntu-latest_avahi
2020-05-20T20:03:22.7465058Z   TEST_FAIL: FALSE
2020-05-20T20:03:22.7465222Z   GDRIVE_CREDENTIALS: /home/runner/work/build-nmos-cpp/build-nmos-cpp/gdrive/credentials.json
2020-05-20T20:03:22.7465390Z   HOST_IP_ADDRESS: 10.1.0.4
2020-05-20T20:03:22.7465530Z ##[endgroup]
2020-05-20T20:03:23.0784518Z #2 [internal] load .dockerignore
2020-05-20T20:03:23.0785360Z #2 transferring context: 2B done
2020-05-20T20:03:23.0785517Z #2 DONE 0.0s
2020-05-20T20:03:23.0785617Z 
2020-05-20T20:03:23.0785852Z #1 [internal] load build definition from Dockerfile
2020-05-20T20:03:23.0786026Z #1 transferring dockerfile: 6.72kB done
2020-05-20T20:03:23.0786172Z #1 DONE 0.0s
2020-05-20T20:03:23.0786241Z 
2020-05-20T20:03:23.0786390Z #3 [internal] load metadata for docker.io/library/ubuntu:bionic
2020-05-20T20:03:43.0453008Z #3 ERROR: failed to do request: Head https://registry-1.docker.io/v2/library/ubuntu/manifests/bionic: dial tcp: lookup registry-1.docker.io on 168.63.129.16:53: read udp 172.17.0.2:49775->168.63.129.16:53: i/o timeout
2020-05-20T20:03:43.0453365Z 
2020-05-20T20:03:43.0453517Z #14 [internal] load build context
2020-05-20T20:03:43.0453661Z #14 DONE 0.0s
2020-05-20T20:03:43.0453742Z 
2020-05-20T20:03:43.0454101Z #4 [stage1-build  1/16] FROM docker.io/library/ubuntu:bionic
2020-05-20T20:03:43.0454269Z #4 resolve docker.io/library/ubuntu:bionic
2020-05-20T20:04:02.9643123Z #4 resolve docker.io/library/ubuntu:bionic 20.0s done
2020-05-20T20:04:02.9644189Z #4 ERROR: failed to do request: Head https://registry-1.docker.io/v2/library/ubuntu/manifests/bionic: dial tcp: lookup registry-1.docker.io on 168.63.129.16:53: read udp 172.17.0.2:48542->168.63.129.16:53: i/o timeout
2020-05-20T20:04:02.9644551Z ------
2020-05-20T20:04:02.9644701Z  > [internal] load metadata for docker.io/library/ubuntu:bionic:
2020-05-20T20:04:02.9644981Z ------
2020-05-20T20:04:02.9645204Z ------
2020-05-20T20:04:02.9645511Z  > [stage1-build  1/16] FROM docker.io/library/ubuntu:bionic:
2020-05-20T20:04:02.9645785Z ------
2020-05-20T20:04:02.9646436Z failed to solve: rpc error: code = Unknown desc = failed to load cache key: failed to do request: Head https://registry-1.docker.io/v2/library/ubuntu/manifests/bionic: dial tcp: lookup registry-1.docker.io on 168.63.129.16:53: read udp 172.17.0.2:48542->168.63.129.16:53: i/o timeout
2020-05-20T20:04:02.9680482Z ##[error]Process completed with exit code 1.
2020-05-20T20:04:02.9872436Z Post job cleanup.
2020-05-20T20:04:03.0385939Z 🚿 Removing builder instance...
2020-05-20T20:04:03.0446315Z [command]/usr/bin/docker buildx rm builder-1b067eda288ff81cb32bc275748c8e6df10cd13a
2020-05-20T20:04:03.3388445Z Post job cleanup.

Previous failed "docker buildx build" job on the same runner fails next run

I'm running buildx on a self-hosted runner, which means that two jobs in the same workflow will run on the same host. If a previous job that uses this action fails for whatever reason (not necessarily a failure in this action), this action fails to finish in all subsequent jobs with the error below:

🔨 Creating a new builder instance...
/usr/bin/docker buildx create --name builder --driver docker-container --use
existing instance for builder but no append mode, specify --node to make changes for existing instances
##[error]The process '/usr/bin/docker' failed with exit code 1

My current workaround is to docker buildx rm builder

Move to Docker organization

I plan to archive this repository following the work I did with the Docker team on an action that will be formalized in their organization: https://github.com/docker/setup-buildx-action

There will be a total of 4 actions:

I have also created another repo to check the behavior of these actions: ci.yml / full.yml.

A real example is available on this repo.

You can already try them out and report any issues you may encounter.

Latest commit breaks the action

Hi Max,

I've been using crazy-max/ghaction-docker-buildx@master for a while now (I probably shouldn't do that), the latest commit seems to break it.

##[error]Could not find file '/home/runner/work/_actions/_temp_284a9c8c-aac8-4c95-8bb4-8306bdefd34f/_staging/crazy-max-ghaction-docker-buildx-4464eda/node_modules/.bin/seek-bunzip'.

I've switched to crazy-max/ghaction-docker-buildx@v1 and the problem is gone.

Please, add aarch64 host support (for self-hosted runners)

Behaviour

On aarch64 self-hosted runner crazy-max/ghaction-docker-buildx@v3 tries to setupamd64 buildx version https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64

Steps to reproduce this issue

  1. set aarch64 self-hosted runner
  2. try to run crazy-max/ghaction-docker-buildx on it

Expected behaviour

It should run same as on x64 at least for linux/arm64, linux/arm/v7, linux/arm/v6 targets

Configuration

https://github.com/iav/test3/blob/master/.github/workflows/parallel.yml

Logs

https://github.com/iav/test5/runs/871253172?check_suite_focus=true#step:3:10

Using cache throws a build error

Please see the workflow file below, here is the error message that I receive:

#23 DONE 0.0s

#24 exporting to image
#24 exporting layers
#24 exporting layers 132.6s done
#24 exporting manifest sha256:bdc7ad2d2e7dfa9ff8cdbff049f0e2dc6daf8bb49088e787cc35e38abb664b5c done
#24 exporting config sha256:ad95a949e86b4f310c7431439ffa2bd4831f2b51af7a60f1d0bfd43c6c5994a0 done
#24 DONE 132.6s

#25 exporting cache
#25 preparing build cache for export
#25 preparing build cache for export 0.4s done
#25 ERROR: invalid incomplete links
------
 > exporting cache:
------
failed to solve: rpc error: code = Unknown desc = invalid incomplete links
##[error]Process completed with exit code 1.

And the workflow file, we build a Dockerfile and want to push it to DockerHub, then run the file at a later step:

name: Build and Test PR

on:
  pull_request:
    branches: [master]

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up Docker Buildx
        uses: crazy-max/ghaction-docker-buildx@v2    
      - name: Cache Docker layers
        uses: actions/cache@v2
        id: cache
        with:
          path: /tmp/.buildx-cache
          key: ${{ runner.os }}-buildx-${{ github.sha }}
          restore-keys: |
            ${{ runner.os }}-buildx-    
      - name: Set Docker image
        env:
          DOCKER_REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }} # docker.io
          DOCKER_IMAGE_BASE: omairvaiyani/synap-web
        run: echo ::set-env name=DOCKER_IMAGE::${DOCKER_REPOSITORY}/${DOCKER_IMAGE_BASE}
      - name: Prepare
        id: prepare
        run: |
          DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
          NPM_AUTH_TOKEN=${{ secrets.NPM_AUTH_TOKEN }}
          VERSION=test
          if [[ $GITHUB_REF == refs/tags/* ]]; then
            VERSION=${GITHUB_REF#refs/tags/v}
          fi
          TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
          if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
            TAGS="$TAGS --tag ${DOCKER_IMAGE}:${VERSION}"
          fi
          echo ::set-output name=build_tag::${VERSION}
          echo ::set-output name=container_name::myapp
          echo ::set-output name=docker_image::${DOCKER_IMAGE}
          echo ::set-output name=version::${VERSION}
          echo ::set-output name=buildx_args:: \
            --build-arg VERSION=${VERSION} \
            --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
            --build-arg VCS_REF=${GITHUB_SHA::8} \
            --build-arg NPM_AUTH_TOKEN=${NPM_AUTH_TOKEN} \
            --target=test \
            ${TAGS} --file ./Dockerfile ./
      - name: Docker Buildx (build)
        id: build
        run: |
          docker buildx build --output "type=image,push=false" --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" ${{ steps.prepare.outputs.buildx_args }}
      - name: Docker Login
        id: docker_login
        if: success()
        env:
          DOCKER_REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}
          DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
          DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
        run: |
          echo "${DOCKER_PASSWORD}" | docker login "${DOCKER_REPOSITORY}" --username "${DOCKER_USERNAME}" --password-stdin
      - name: Docker Buildx (push)
        id: push_image
        if: success()
        run: |
          docker buildx build --output "type=image,push=true" --cache-from "type=local,src=/tmp/.buildx-cache" ${{ steps.prepare.outputs.buildx_args }}
      - name: Testing
        id: test
        run: docker run --name ${{ steps.prepare.outputs.container_name }} ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.build_tag }}
      - name: Clear
        if: always()
        run: |
          rm -f ${HOME}/.docker/config.json    

As an aside, this particular workflow does not really require the build to be pushed to our remote repository, as we only test it locally inside the workflow. But I'm using pushing the cache to hopefully speed up the build. I will however, need to push the image for other worflows, such as deployment.

Also by removing the cache and adding the --platform settings, I get the following error:

#131 [linux/amd64 base 1/7] FROM ***/library/node:12.14.0@sha256:f490eb...
#131 sha256:f490ebb9c7d5dcf1a8a1e4d3b3a65e133be44d26abb66815ca1612ef69410c51 1.21kB / 1.21kB done
#131 CANCELED

#31 [linux/ppc64le build 1/7] FROM ***/library/node:12.14.0@sha256:f49...
#31 sha256:f490ebb9c7d5dcf1a8a1e4d3b3a65e133be44d26abb66815ca1612ef69410c51 1.21kB / 1.21kB done
#31 CANCELED
------
 > [linux/386 internal] load metadata for ***/library/node:12.14.0:
------
------
 > [linux/arm/v6 internal] load metadata for ***/library/node:12.14.0:
------
------
 > [linux/386 build 1/7] FROM ***/library/node:12.14.0:
------
------
 > [linux/arm/v6 build 1/7] FROM ***/library/node:12.14.0:
------
failed to solve: rpc error: code = Unknown desc = failed to load cache key: no match for platform in manifest sha256:f490ebb9c7d5dcf1a8a1e4d3b3a65e133be44d26abb66815ca1612ef69410c51: not found

`authorization failed` trying to --push to dockerhub

Got authorization failed trying to do docker build buildx --push to dockerhub.

no error:

 echo -e "from alpine\n  run echo hello! \n \n" | tee dtest
 docker buildx build -f dtest -t dtest -t shtripok/rust-musl-builder:dtest-load --load .
docker push shtripok/rust-musl-builder:dtest-load

and immediately after, in same script:
docker buildx build -f dtest -t dtest -t shtripok/rust-musl-builder:dtest-push --push .
error.

Line in action script https://github.com/iav/rust-musl-builder/blob/arm/.github/workflows/dh-build.yml#L106
related log line: https://github.com/iav/rust-musl-builder/runs/729084875#step:9:464

Unable to push tagged image to registry

Thanks for this useful Action.

I'm trying to build my image and push it to the registry in separate steps. I try to tag the built container image as $IMAGE_NAME and then refer to the image by that tag when pushing.

However, I get told that $IMAGE_NAME:latest is unknown to Docker during the push step.

I saw in one of your examples you basically duplicate the whole docker Buildx build command, but shouldn't it be possible to refer to it by tag?

 - name: Build
        run: |
          docker buildx build \
            --platform ${{ matrix.arch }} \
            --output type=image,name=$IMAGE_NAME,push=false \
            .
      - name: Log into registry
        ...

      - name: Push image
        run: |
          # re-tag the image and push
          docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
          docker push $IMAGE_ID:$VERSION

Add support for DOCKER_CONFIG

Hi!

First, I'll join #11 by thanking you for bringing us this GH actions, it's super useful and I find it well written 🙂

I've been encountering this issue within the crazy-max/ghaction-docker-buildx step:

docker: 'buildx' is not a docker command.
See 'docker --help'

I've had a hard time with tmate finding out the root cause.

We're using Azure/docker-login to handle the docker registry login seamlessly and it happens they set the DOCKER_CONFIG environment variable for the whole job [ref].

The root cause being that the docker client configuration location is hard-coded [ref].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.