docker / build-push-action

GitHub Action to build and push Docker images with Buildx
https://github.com/marketplace/actions/build-and-push-docker-images
Apache License 2.0
4.24k stars 541 forks source link

GitHub Action can use mamba to build regular projects but fails to build during Docker build #914

Closed ZhangxiJesseFeng closed 1 year ago

ZhangxiJesseFeng commented 1 year ago

Troubleshooting

Before submitting a bug report please read the Troubleshooting doc.

Behaviour

Steps to reproduce this issue

  1. Running GitHub action docker build:
    env:
    REGISTRY: ghcr.io
    IMAGE_NAME: ${{ github.repository }}
    jobs:
    build-docker-image:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
    runs-on: ${{ matrix.os }}
    permissions:
      contents: read
      packages: write
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Build container
        run: docker build -f Dockerfile -t rietveld .
  2. Job fails at Build container step
  3. Log can be found at: https://github.com/lanl/MILK/actions/runs/5682611743/job/15401368032

Expected behaviour

4 weeks ago, there were no issues. The job just builds and publishes. You can see from the history of the actions that this is true.

Actual behaviour

We had made no changes in the code that should affect this, but as of last 2 weeks, the docker build on GitHub Actions continues to fail and the error and warning messages are difficult to decipher on what the issue actually is. It complains about mamba but mamba is perfectly fine when used in other action jobs not using Docker and they can build successfully.

Configuration

name: Build and Publish Rietveld Docker Image

env:
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}
jobs:
  build-docker-image:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
    runs-on: ${{ matrix.os }}
    permissions:
      contents: read
      packages: write
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Build container
        run: docker build -f Dockerfile -t rietveld .

  publish-container-image:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
    runs-on: ${{ matrix.os }}
    needs: [build-docker-image]
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - name: Login to GitHub Container Registry
        uses: docker/login-action@v2
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@v4.6.0
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
      - name: Build and push to local registry
        uses: docker/build-push-action@v4
        with:
          context: .
          push: true
          platforms: linux/amd64,linux/arm64
          tags: ${{ env.REGISTRY }}/lanl/milk:${{ github.ref_name }}-${{github.sha}}

Logs

Log downloaded from the job, can also be found in the link provided above. logs_264.zip

crazy-max commented 1 year ago

I don't know what is mamba but the error does not look related to the action: https://github.com/lanl/MILK/actions/runs/5682611743/job/15401368032#step:3:8

image

ZhangxiJesseFeng commented 1 year ago

I don't know what is mamba but the error does not look related to the action: https://github.com/lanl/MILK/actions/runs/5682611743/job/15401368032#step:3:8

image

It might not look like it is related to the action, but mamba works in other actions, and when calling Docker build, it calls mamba automatically and fails. Did I submit this issue in the wrong repo?

crazy-max commented 1 year ago

I think it's in the wrong repo yes, it fails before any invocation of our action.

ZhangxiJesseFeng commented 1 year ago

I think it's in the wrong repo yes, it fails before any invocation of our action.

Ok thanks for the info. I thought this is the repo because the job failed when trying to run

     - name: Build container
        run: docker build -f Dockerfile -t rietveld .

Do you know which repo I should go to report this?

crazy-max commented 1 year ago

Do you know which repo I should go to report this?

I don't know I have no knowledge about mamba. This repo is about the docker build-push action.

I thought this is the repo because the job failed when trying to run

But it fails here: https://github.com/lanl/MILK/blob/cc90fb076e5c9eba890c22ba4248a1fdc05e60f/.github/workflows/build_docker_linux.yml#L35

      - name: mamba information
        run: mamba info

And this repo does not run plain docker build command but a dedicated action.

Closing since this is out of scope.