vegardit/docker-gitea-act-runner

dind-rootless-latest need git as dependency

Closed this issue · 5 comments

Hello,

I'm using vegardit/gitea-act-runner:dind-rootless-latest and trying to build a docker image.

Runner config

version: "3.8"
services:
  runner:
    image: vegardit/gitea-act-runner:dind-rootless-latest
    privileged: true
    environment:
      GITEA_INSTANCE_URL: https://git.**REDACTED**
      GITEA_RUNNER_REGISTRATION_TOKEN: **REDACTED**
      GITEA_RUNNER_NAME: **REDACTED**
      GITEA_RUNNER_MAX_PARALLEL_JOBS: 2
      ACT_CACHE_SERVER_HOST: **REDACTED**
      ACT_CACHE_SERVER_PORT: 22380
    ports:
      - 22380:22380
    volumes:
      - ./data:/data

Gitea action config

name: Build Server

on:
  push:
    branches:
      - main

jobs:
  docker:
    runs-on: ubuntu-latest
    container:
      image: catthehacker/ubuntu:act-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Fix Docker Permission
        uses: https://github.com/imlonghao/gitea-runner-docker-permission-fix@main
      - name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          registry: git.**REDACTED**
          username: imlonghao
          password: **REDACTED**
      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: git.**REDACTED**-server
          tags: |
            type=sha
            type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}            
      - name: Build and push
        uses: docker/build-push-action@v5
        with:
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          file: Dockerfile.server

I got this error on the Build and push phase

[command]/usr/bin/docker buildx version
github.com/docker/buildx 0.12.0-1 542e5d810e4a1a155684f5f3c5bd7e797632a12f
::endgroup::
[command]/usr/bin/docker buildx build --file Dockerfile.server --iidfile /tmp/docker-actions-toolkit-E6zD2Y/iidfile --secret id=GIT_AUTH_TOKEN,src=/tmp/docker-actions-toolkit-E6zD2Y/tmp-149-vIMXPDX5m5Bl --tag git.**REDACTED**-server:latest --tag git.**REDACTED**-server:sha-5c1d154 --metadata-file /tmp/docker-actions-toolkit-E6zD2Y/metadata-file --push https://git.**REDACTED**/imlonghao/**REDACTED**.git#**REDACTED**35d02e1754
#0 building with "default" instance using docker driver
#1 [internal] load git source https://git.**REDACTED**.git#**REDACTED**135d02e1754
#1 ERROR: failed to init repo at /data/.local/share/docker/fuse-overlayfs/5xrld60bvz69ds96yah8z4d6z/diff: exec: "git": executable file not found in $PATH
------
 > [internal] load git source https://git.**REDACTED**.git#**REDACTED**135d02e1754:
------
ERROR: failed to solve: failed to read dockerfile: failed to init repo at /data/.local/share/docker/fuse-overlayfs/5xrld60bvz69ds96yah8z4d6z/diff: exec: "git": executable file not found in $PATH
::error::buildx failed with: ERROR: failed to solve: failed to read dockerfile: failed to init repo at /data/.local/share/docker/fuse-overlayfs/5xrld60bvz69ds96yah8z4d6z/diff: exec: "git": executable file not found in $PATH

Patching the image with this Dockerfile works for me

FROM vegardit/gitea-act-runner:dind-rootless-latest
RUN sudo apt update && sudo apt install -y --no-install-recommends git && sudo rm -rf /var/lib/apt/lists/*

I suggest we can add git to

apt-get install --no-install-recommends -y binutils ca-certificates curl sudo tini

Interesting, I don't really understand why this is necessary. To my understanding all commands incl. git should be executed within the catthehacker/ubuntu:act-22.04 container and not on the host.

Yeah, it's a little weird behavior.
I have another action worker running in vegardit/gitea-act-runner:latest image, which works fine without the git installed.
So I sometimes just keep restarting the action job until it got assign to this runner.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If the issue is still valid, please add a respective comment to prevent this issue from being closed automatically. Thank you for your contributions.

still an issue

Having something similar happen on the dind image:

name: Build and push container
on: [push]

jobs:
  release-image:
      runs-on: ubuntu-latest
      steps:
        - name: Checkout
          uses: actions/checkout@v4
          with:
            fetch-depth: 0 # all history for all branches and tags

        - name: Log in to the Container registry
          uses: docker/login-action@v3
          with:
            registry: http://xxx
            username: root
            password: ${{ secrets.GITEAROOT }}
    
        - name: Build and push
          uses: docker/build-push-action@v6
          with:
            file: ./a/Dockerfile
            push: true
            tags: |
              xxx/root/b:1.0.0.${{ github.run_id }}
              xxx/root/b:latest

worked recently but now has a

ERROR: failed to solve: failed to read dockerfile: failed to init repo at /var/lib/docker/overlay2/kcd6252t1mjm4xik53ozs8d30/diff: git stderr:
: exec: "git": executable file not found in $PATH
::group::Reference
default/default/b7bazlswz6loj7fmds4iinjbj
::endgroup::
::group::Check build summary support
Build summary is not yet supported on GHES
::endgroup::
::error::buildx failed with: : exec: "git": executable file not found in $PATH

error