Base Images — Gitea Actions
This guide shows how to set up a base-images pipeline using Gitea Actions, the GitHub Actions-compatible CI system built into Gitea.
Workflow file
Section titled “Workflow file”name: Base images pipeline
on: push: branches: [main] schedule: - cron: "0 6 * * *" # daily at 06:00 UTC workflow_dispatch: inputs: phase: description: "Phases to run (sync,build,eol-update,status,cleanup)" required: false default: "sync,build,status"
jobs: sync: name: Sync mirrors runs-on: ubuntu-latest container: image: registry.gitlab.com/imglife-project/imglife:latest steps: - name: Checkout uses: actions/checkout@v4
- name: Sync run: imglife sync env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} IMGLIFE_DOCKER_IO_USERNAME: ${{ vars.DOCKER_HUB_USERNAME }} IMGLIFE_DOCKER_IO_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
build: name: Build base images needs: sync runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4
- name: Set up Docker Buildx uses: docker/setup-buildx-action@v3
- name: Login to registry uses: docker/login-action@v3 with: registry: gitea.example.com username: ${{ gitea.actor }} password: ${{ secrets.GITEA_TOKEN }}
- name: Build run: | docker buildx create --name imglife-builder --use --bootstrap imglife --config imglife.yaml build env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
eol-update: name: Update EOL data runs-on: ubuntu-latest if: github.event_name == 'schedule' container: image: registry.gitlab.com/imglife-project/imglife:latest steps: - name: Checkout uses: actions/checkout@v4
- name: Update EOL data run: imglife eol update env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
- name: Commit if changed run: | git config user.email "ci-bot@gitea.example.com" git config user.name "CI Bot" if git diff --quiet eol-data.yaml; then echo "No changes" else git add eol-data.yaml git commit -m "chore(lifecycle): update EOL data [skip ci]" git push env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
status: name: Generate status report needs: [build] runs-on: ubuntu-latest container: image: registry.gitlab.com/imglife-project/imglife:latest steps: - name: Checkout uses: actions/checkout@v4
- name: Generate status run: imglife status --output README.md env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
- name: Commit if changed run: | git config user.email "ci-bot@gitea.example.com" git config user.name "CI Bot" if git diff --quiet README.md; then echo "No changes" else git add README.md git commit -m "chore(status): update status report [skip ci]" git push
cleanup: name: Cleanup stale tags runs-on: ubuntu-latest if: github.event_name == 'workflow_dispatch' container: image: registry.gitlab.com/imglife-project/imglife:latest steps: - name: Checkout uses: actions/checkout@v4
- name: Cleanup run: imglife cleanup env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}imglife.yaml for Gitea
Section titled “imglife.yaml for Gitea”registry: provider: gitea url: https://gitea.example.com owner: myorg repo: base-images
sync: entries: - source: docker.io/library/alpine tag_regex: '^3\.\d+\.\d+$' keep_last: 3 target: gitea.example.com/myorg/mirrors/alpine lifecycle: product: alpine extract: minor
build: core_version: "1.0.0" registry: gitea.example.com/myorg/bases
images: - name: alpine folder: images/alpine type: core mirror_image: gitea.example.com/myorg/mirrors/alpine mirror_tag: "3.21.3" version: "3.21.3"
retention: keep_last: 5 max_age_days: 90
lifecycle: eol_provider: endoflife eol_target: git eol_data_file: eol-data.yamlSecrets to configure
Section titled “Secrets to configure”In Gitea, go to Repository Settings > Secrets and add:
| Secret | Description |
|---|---|
GITEA_TOKEN | Gitea token with package and write:repository scopes |
DOCKER_HUB_PASSWORD | Docker Hub password (to avoid rate limits) |