mirror of https://code.forgejo.org/forgejo/runner
ci(actions): add build docker image workflow (#118)
### Add secret ``` DOCKERHUB_TOKEN=xxx ``` ### Tag when tag like `v1.0.0`, it will build multi platform docker image `gitea/act_runner:1.0.0` and `gitea/act_runner:latest`, then push to docker hub ### Use > volume `/data` save `.runner` config file > volume `/root/.cache` save actcache and actions cache ```sh docker run -e GITEA_INSTANCE_URL=*** \ -e GITEA_RUNNER_REGISTRATION_TOKEN=*** \ -e GITEA_RUNNER_NAME=*** \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /root/act_runner/data:/data \ -v /root/act_runner/cache:/root/.cache \ gitea/act_runner ``` Test join runners success ![image](/attachments/f5287e93-e27c-420f-a3d5-8f9b54bfdbb6) Test run action success ![image](/attachments/7235af17-f598-4fc8-88b4-d4771b1f07cd) Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/118 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: seepine <seepine@noreply.gitea.io> Co-committed-by: seepine <seepine@noreply.gitea.io>pull/25/head
parent
293926f5d5
commit
66bab3d805
|
@ -0,0 +1,46 @@
|
||||||
|
name: Build image
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
jobs:
|
||||||
|
build-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
env:
|
||||||
|
DOCKER_USERNAME: gitea
|
||||||
|
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 DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ env.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Get Meta
|
||||||
|
id: meta
|
||||||
|
run: |
|
||||||
|
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
||||||
|
echo REPO_VERSION=$(echo ${{ github.ref }} | awk -F"/" '{print $3}' | awk -F"v" '{print $2}') >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ env.DOCKER_USERNAME }}/${{ steps.meta.outputs.REPO_NAME }}:latest
|
||||||
|
${{ env.DOCKER_USERNAME }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
|
Loading…
Reference in New Issue