Skip to content

Gitea Actions & Registry

Configuration actuelle

Service URL
Gitea http://localhost:3000
Registry Docker http://localhost:3000/v2/
act_runner /home/pham/labs/gitlab/act_runner

Registry Docker

La registry est au niveau organisation, pas par projet :

localhost:3000/<org>/<image>:<tag>
localhost:3000/poc/test:latest

Push une image

docker login localhost:3000 -u admin
docker build -t localhost:3000/poc/mon-image:latest .
docker push localhost:3000/poc/mon-image:latest

Voir les images

http://localhost:3000/poc/-/packages

act_runner

Installation

cd /home/pham/labs/gitlab
wget https://dl.gitea.com/act_runner/0.2.11/act_runner-0.2.11-linux-amd64 -O act_runner
chmod +x act_runner

Enregistrement

  1. Gitea → Site AdministrationActionsRunners → Copier le token
  2. Enregistrer :
./act_runner register --no-interactive \
  --instance http://localhost:3000 \
  --token <TOKEN> \
  --name runner-local \
  --labels ubuntu-latest:host

Lancer

./act_runner daemon

Service systemd

sudo cp /home/pham/labs/gitlab/act_runner.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable act_runner
sudo systemctl start act_runner

Workflow exemple

Fichier .gitea/workflows/build.yml :

name: Build and Push

on:
  push:
    branches: [main, master]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Login Registry
        run: echo "password" | docker login localhost:3000 -u admin --password-stdin

      - name: Build & Push
        run: |
          docker build -t localhost:3000/poc/${{ github.event.repository.name }}:${{ github.sha }} .
          docker build -t localhost:3000/poc/${{ github.event.repository.name }}:latest .
          docker push localhost:3000/poc/${{ github.event.repository.name }}:${{ github.sha }}
          docker push localhost:3000/poc/${{ github.event.repository.name }}:latest

Utiliser dans Nomad

config {
  image = "localhost:3000/poc/mon-app:latest"
}