actions / actions-runner-controller

Kubernetes controller for GitHub Actions self-hosted runners
Apache License 2.0
4.65k stars 1.1k forks source link

Build `docker buildx` into runners #2571

Open jwhitaker-swiftnav opened 1 year ago

jwhitaker-swiftnav commented 1 year ago

What would you like added?

Add the docker buildx plugin to the default runners

Why is this needed?

I'm aware of and sympathetic to the desire to keep the runners slimmer than the github hosted runners, but could a special case be made for docker buildx?

I wouldn't ask this for any other tool, promise!

Happy to contribute a PR if this is acceptable but wanted to check your amenability first. Thanks for maintaining this system!

github-actions[bot] commented 1 year ago

Hello! Thank you for filing an issue.

The maintainers will triage your issue shortly.

In the meantime, please take a look at the troubleshooting guide for bug reports.

If this is a feature request, please review our contribution guidelines.

pof-jhansilva commented 11 months ago

Any updates on this one? I wouldn't like this to go stale if that's possible, this would be great to have as we could steps like this for our builds; which really makes things easier.

  - name: Build and push Docker image # Can't use this step because we need buildx.
        uses: docker/build-push-action@v3
        with:
          context: .
          tags: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
          file: Dockerfile  # Your Dockerfile name
          push: true
Vladyslav-Miletskyi commented 9 months ago

Hello @pof-jhansilva You can try running workflow like this:

    - name: Set up QEMU
      uses: docker/setup-qemu-action@v3
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3
    - name: Build and push Docker image
      uses: docker/build-push-action@v3
      with:
        context: .
        tags: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
        file: Dockerfile  # Your Dockerfile name
        push: true
ctriley commented 7 months ago

any update on this? Buildkit is enabled by default in docker desktop. So not having buildkit in this image is painful. Dockerfiles which use buildx features cannot even be built.

example: any dockerfile with COPY --chmod=

jrbe228 commented 7 months ago

I ended up needing compose when using ARC + DinD runners. Hacky solution:

FROM ghcr.io/actions/actions-runner:latest
USER 0
RUN apt-get update && apt-get install -y curl
RUN curl -L https://github.com/docker/compose/releases/download/v2.24.6/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
RUN chmod +x /usr/local/bin/docker-compose
RUN docker-compose version    #Verify no errors post-installation
USER runner

Build the image and retag prior to deploying ARC: docker build -t actions-runner:compose .

Edit - Made a repo.

ohookins commented 7 months ago

Agree, it would be good to get docker-compose in the base image here as it's so commonly used.

dverbeek84 commented 5 months ago

Upgrading the docker version to 25.x will solve this issue.