Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random crashes when building Image for 'linux/arm64' #403

Closed
3 tasks done
gerb-ster opened this issue Jan 24, 2025 · 7 comments
Closed
3 tasks done

Random crashes when building Image for 'linux/arm64' #403

gerb-ster opened this issue Jan 24, 2025 · 7 comments

Comments

@gerb-ster
Copy link

Contributing guidelines

I've found a bug, and:

  • The documentation does not mention anything about my problem
  • There are no open or closed issues that are related to my problem

Description

Since a couple of days my Github Action I've setup to build & push a container image keeps failing. Sometimes it works & completes, but most of the time it fails when these kind of messages:

ERROR: failed to solve: process "/bin/sh -c docker-php-ext-install pdo_mysql" did not complete successfully: exit code: 77

or

checking whether the C compiler works... configure: error: in `/usr/src/php/ext/zip':
configure: error: cannot run C compiled programs.

or

ERROR: failed to solve: process "/bin/sh -c docker-php-ext-install zip" did not complete successfully: exit code: 77

I haven't changed or modified my GitHubAction yml file recently; it's very strange because sometimes (1 or 2 times out of 10) it runs and completes succesfully.

The content of my github action file:

name: Build & Push

on:
  push:
    tags: [ 'v*.*.*' ]

env:
  REGISTRY: "ghcr.io"
  IMAGE_NAME: ${{ github.repository }}
  TAG_NAME: ${{ github.repository }}

jobs:
  build-and-push:
    runs-on: ubuntu-latest
    permissions:
      packages: write
      contents: read
      attestations: write
      id-token: write

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.3

      - name: Composer update & install
        run: cd web-app/ && composer update && composer install --prefer-dist --no-suggest --no-progress

      - name: NPM install & build
        uses: actions/setup-node@v4
        with:
          node-version: '22.x'
      - run: cd web-app/ && npm install
      - run: cd web-app/ && npm run build
      - run: cd web-app/ && npm prune --production
      - run: rm -Rf web-app/node_modules/

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Log in to the Container registry
        uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

      - name: Build and push Docker image
        id: push
        uses: docker/build-push-action@v6
        with:
          context: ./web-app
          file: ./web-app/docker/backend.prod.dockerfile
          push: true
          platforms: linux/arm64
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

Expected behaviour

I would expect consistent results, either failed or succeeded builds.

Actual behaviour

Builds seem te fail at random, with different results

Repository URL

No response

Workflow run URL

No response

YAML workflow

name: Build & Push

on:
  push:
    tags: [ 'v*.*.*' ]

env:
  REGISTRY: "ghcr.io"
  IMAGE_NAME: ${{ github.repository }}
  TAG_NAME: ${{ github.repository }}

jobs:
  build-and-push:
    runs-on: ubuntu-latest
    permissions:
      packages: write
      contents: read
      attestations: write
      id-token: write

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.3

      - name: Composer update & install
        run: cd web-app/ && composer update && composer install --prefer-dist --no-suggest --no-progress

      - name: NPM install & build
        uses: actions/setup-node@v4
        with:
          node-version: '22.x'
      - run: cd web-app/ && npm install
      - run: cd web-app/ && npm run build
      - run: cd web-app/ && npm prune --production
      - run: rm -Rf web-app/node_modules/

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Log in to the Container registry
        uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

      - name: Build and push Docker image
        id: push
        uses: docker/build-push-action@v6
        with:
          context: ./web-app
          file: ./web-app/docker/backend.prod.dockerfile
          push: true
          platforms: linux/arm64
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

Workflow logs

No response

BuildKit logs


Additional info

No response

@crazy-max
Copy link
Member

Don't think this is related to setup-buildx-action but QEMU similar to docker/setup-qemu-action#188

This is tracked in tonistiigi/binfmt#215

What you can try is using qemu v8 to see if this fixes the issue for you: tonistiigi/binfmt#215 (comment)

@gerb-ster
Copy link
Author

@crazy-max thanks! I'll give it a try!

@gerb-ster
Copy link
Author

@crazy-max I've just tried your solution (using image v8) and so far, so good. Although it is an intermittent issue, having 2 consecutive successful builds looks very promising. Thanks!

@cagnulein
Copy link

same here https://github.com/cagnulein/qdomyos-zwift/actions
let's see if the qemu v8 will work too! thanks!

@cagnulein
Copy link

unfortunately it doesn't work here, it's even worst (segmentation fault at the very beginning) https://github.com/cagnulein/qdomyos-zwift/actions/runs/12968351189/job/36171249702

@cagnulein
Copy link

@crazy-max how can i downgrade setup-buildx-action to the previous build? version seems to effect buildx not setup-buildx-action

@cagnulein
Copy link

i mean i'm trying to use the previous here https://github.com/cagnulein/qdomyos-zwift/pull/3084/files without success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants