Run as container? #8

Closed
opened 2022-12-08 13:16:38 +00:00 by Ghost · 11 comments
  • Add a Dockerfile
  • Add a docker-compose.yml
    • mount unix:///var/run/docker.sock
  • Add a .drone.yml
    • Build and publish to Docker Hub
- [ ] Add a Dockerfile - [ ] Add a docker-compose.yml - mount ` unix:///var/run/docker.sock` - [ ] Add a `.drone.yml` - Build and publish to Docker Hub

Yes, that'll be nice.

And maybe we will use act_runner to build act_runner one day.

Yes, that'll be nice. And maybe we will use act_runner to build act_runner one day.
wolfogre added the
kind
enhancement
label 2022-12-09 04:02:30 +00:00

Instead of a .drone.yml you may use Gitea Actions, e.g. .gitea/workflows/release.yml?

Something similar to ...

name: release

on:
  workflow_dispatch:
  push:
    tags:
      - "*"

jobs:
  registries:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Get Docker metadata
        id: meta
        uses: docker/metadata-action@v4
        with:
          images: docker.io/{username}/act_runner
          tags: |
            type=ref,event=tag
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=semver,pattern={{major}}            
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - name: Login to DockerHub
        uses: docker/login-action@v2
        with:
          registry: docker.io
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v3
        with:
          context: .
          file: ./Dockerfile
          platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
          push: true
          labels: ${{ steps.meta.outputs.labels }}
          tags: ${{ steps.meta.outputs.tags }}
      - name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}
Instead of a `.drone.yml` you may use Gitea [Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/), e.g. `.gitea/workflows/release.yml`? Something similar to ... ```yml name: release on: workflow_dispatch: push: tags: - "*" jobs: registries: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Get Docker metadata id: meta uses: docker/metadata-action@v4 with: images: docker.io/{username}/act_runner tags: | type=ref,event=tag type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to DockerHub uses: docker/login-action@v2 with: registry: docker.io username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push id: docker_build uses: docker/build-push-action@v3 with: context: . file: ./Dockerfile platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x push: true labels: ${{ steps.meta.outputs.labels }} tags: ${{ steps.meta.outputs.tags }} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} ```

Instead of a .drone.yml you may use Gitea Actions, e.g. .gitea/workflows/release.yml?

Something similar to ...

name: release

on:
  workflow_dispatch:
  push:
    tags:
      - "*"

jobs:
  registries:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Get Docker metadata
        id: meta
        uses: docker/metadata-action@v4
        with:
          images: docker.io/{username}/act_runner
          tags: |
            type=ref,event=tag
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=semver,pattern={{major}}            
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - name: Login to DockerHub
        uses: docker/login-action@v2
        with:
          registry: docker.io
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v3
        with:
          context: .
          file: ./Dockerfile
          platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
          push: true
          labels: ${{ steps.meta.outputs.labels }}
          tags: ${{ steps.meta.outputs.tags }}
      - name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}

Hi, how to get the actions plugin from a local repo instead of https://gitea.com/actions/
?

> Instead of a `.drone.yml` you may use Gitea [Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/), e.g. `.gitea/workflows/release.yml`? > > Something similar to ... > > ```yml > name: release > > on: > workflow_dispatch: > push: > tags: > - "*" > > jobs: > registries: > runs-on: ubuntu-latest > steps: > - name: Checkout > uses: actions/checkout@v3 > - name: Get Docker metadata > id: meta > uses: docker/metadata-action@v4 > with: > images: docker.io/{username}/act_runner > tags: | > type=ref,event=tag > type=semver,pattern={{version}} > type=semver,pattern={{major}}.{{minor}} > type=semver,pattern={{major}} > - name: Set up QEMU > uses: docker/setup-qemu-action@v2 > - name: Set up Docker Buildx > uses: docker/setup-buildx-action@v2 > - name: Login to DockerHub > uses: docker/login-action@v2 > with: > registry: docker.io > username: ${{ secrets.DOCKERHUB_USERNAME }} > password: ${{ secrets.DOCKERHUB_TOKEN }} > - name: Build and push > id: docker_build > uses: docker/build-push-action@v3 > with: > context: . > file: ./Dockerfile > platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x > push: true > labels: ${{ steps.meta.outputs.labels }} > tags: ${{ steps.meta.outputs.tags }} > - name: Image digest > run: echo ${{ steps.docker_build.outputs.digest }} > ``` Hi, how to get the actions plugin from a local repo instead of https://gitea.com/actions/ ?

Instead of a .drone.yml you may use Gitea Actions, e.g. .gitea/workflows/release.yml?

Something similar to ...

name: release

on:
  workflow_dispatch:
  push:
    tags:
      - "*"

jobs:
  registries:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Get Docker metadata
        id: meta
        uses: docker/metadata-action@v4
        with:
          images: docker.io/{username}/act_runner
          tags: |
            type=ref,event=tag
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=semver,pattern={{major}}            
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - name: Login to DockerHub
        uses: docker/login-action@v2
        with:
          registry: docker.io
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v3
        with:
          context: .
          file: ./Dockerfile
          platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
          push: true
          labels: ${{ steps.meta.outputs.labels }}
          tags: ${{ steps.meta.outputs.tags }}
      - name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}

Hi, how to get the actions plugin from a local repo instead of https://gitea.com/actions/
?

Currently it hasn't been supported. But you can use remote action plugins.

uses: https://github.com/my_actions/my_action@v3

Any website implemented git http protocol has been supported.

> > Instead of a `.drone.yml` you may use Gitea [Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/), e.g. `.gitea/workflows/release.yml`? > > > > Something similar to ... > > > > ```yml > > name: release > > > > on: > > workflow_dispatch: > > push: > > tags: > > - "*" > > > > jobs: > > registries: > > runs-on: ubuntu-latest > > steps: > > - name: Checkout > > uses: actions/checkout@v3 > > - name: Get Docker metadata > > id: meta > > uses: docker/metadata-action@v4 > > with: > > images: docker.io/{username}/act_runner > > tags: | > > type=ref,event=tag > > type=semver,pattern={{version}} > > type=semver,pattern={{major}}.{{minor}} > > type=semver,pattern={{major}} > > - name: Set up QEMU > > uses: docker/setup-qemu-action@v2 > > - name: Set up Docker Buildx > > uses: docker/setup-buildx-action@v2 > > - name: Login to DockerHub > > uses: docker/login-action@v2 > > with: > > registry: docker.io > > username: ${{ secrets.DOCKERHUB_USERNAME }} > > password: ${{ secrets.DOCKERHUB_TOKEN }} > > - name: Build and push > > id: docker_build > > uses: docker/build-push-action@v3 > > with: > > context: . > > file: ./Dockerfile > > platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x > > push: true > > labels: ${{ steps.meta.outputs.labels }} > > tags: ${{ steps.meta.outputs.tags }} > > - name: Image digest > > run: echo ${{ steps.docker_build.outputs.digest }} > > ``` > > Hi, how to get the actions plugin from a local repo instead of https://gitea.com/actions/ > ? > Currently it hasn't been supported. But you can use remote action plugins. ``` uses: https://github.com/my_actions/my_action@v3 ``` Any website implemented git http protocol has been supported.

Are there any docker images for act_runner yet? If not, I just created one that is successfully running on my local machine and connecting to my self hosted gitea.
If there are no images yet, my goal would also be to build a helm chart with dind approach.

Are there any docker images for act_runner yet? If not, I just created one that is successfully running on my local machine and connecting to my self hosted gitea. If there are no images yet, my goal would also be to build a helm chart with dind approach.

Are there any docker images for act_runner yet? If not, I just created one that is successfully running on my local machine and connecting to my self hosted gitea.
If there are no images yet, my goal would also be to build a helm chart with dind approach.

There are no official binaries and images yet, because we are waiting https://github.com/go-gitea/gitea/pull/22803 merge so that we can begin building act_runner official binaries and images via act_runner.

> Are there any docker images for act_runner yet? If not, I just created one that is successfully running on my local machine and connecting to my self hosted gitea. > If there are no images yet, my goal would also be to build a helm chart with dind approach. There are no official binaries and images yet, because we are waiting https://github.com/go-gitea/gitea/pull/22803 merge so that we can begin building `act_runner` official binaries and images via `act_runner`.

Official binaries are now in https://dl.gitea.com/act_runner/ . So how does one create official docker/OCI images from those?

Official binaries are now in https://dl.gitea.com/act_runner/ . So how does one create official docker/OCI images from those?

Official binaries are now in https://dl.gitea.com/act_runner/ . So how does one create official docker/OCI images from those?

Some PRs want to fix it.

> Official binaries are now in https://dl.gitea.com/act_runner/ . So how does one create official docker/OCI images from those? Some PRs want to fix it.

@ptman you can give this a try in the meantime https://github.com/vegardit/docker-gitea-act-runner

@ptman you can give this a try in the meantime https://github.com/vegardit/docker-gitea-act-runner

I opened #84 as a simple proposal, which includes:

a) A very simple Dockerfile for act_runner.

b) A second Dockerfile for a task executor that has Docker and NodeJS.

c) Sets TaskInput.privileged=true

Taken together allows for running act_runner as a container, which executes its tasks by launching containers which themselves support Docker-in-Docker, allowing for the use of docker run, docker compose, etc. inside workflows*.

The process would be something like:

NOTE: I used the same ENV names as the above mentioned project, for consistency.


> docker build . -t act_runner:local

> docker build . -t act_runner-task-executor:local -f Dockerfile.task-executor

> cat >> act_runner.env <<EOF
GITEA_RUNNER_REGISTRATION_TOKEN=MY_TOKEN_GOES_HERE
GITEA_INSTANCE_URL=http://my.gitea.url:3000
GITEA_RUNNER_LABELS=ubuntu-latest:docker://act_runner-task-executor:local
EOF

> docker run -d -v `pwd`/data:/data --env-file act_runner.env -v /var/run/docker.sock:/var/run/docker.sock act_runner:local

  • While you could use docker run/compose inside workflows without dind by accessing /var/run/docker.sock on the host, there would be no way to guarantee cleanup, especially if tasks failed. In contrast, with dind, when the parent task container is destroyed by act_runner, any child containers will go with it.
I opened https://gitea.com/gitea/act_runner/pulls/84 as a simple proposal, which includes: a) A very simple Dockerfile for act_runner. b) A second Dockerfile for a task executor that has Docker and NodeJS. c) Sets `TaskInput.privileged=true` Taken together allows for running `act_runner` as a container, which executes its tasks by launching containers which themselves support Docker-in-Docker, allowing for the use of `docker run`, `docker compose`, etc. inside workflows*. The process would be something like: > NOTE: I used the same ENV names as the above mentioned project, for consistency. ``` > docker build . -t act_runner:local > docker build . -t act_runner-task-executor:local -f Dockerfile.task-executor > cat >> act_runner.env <<EOF GITEA_RUNNER_REGISTRATION_TOKEN=MY_TOKEN_GOES_HERE GITEA_INSTANCE_URL=http://my.gitea.url:3000 GITEA_RUNNER_LABELS=ubuntu-latest:docker://act_runner-task-executor:local EOF > docker run -d -v `pwd`/data:/data --env-file act_runner.env -v /var/run/docker.sock:/var/run/docker.sock act_runner:local ``` * While you could use `docker run/compose` inside workflows without dind by accessing `/var/run/docker.sock` on the host, there would be no way to guarantee cleanup, especially if tasks failed. In contrast, with dind, when the parent task container is destroyed by act_runner, any child containers will go with it.

Closed by #84

Closed by #84
Sign in to join this conversation.
There is no content yet.