feat: update GitOps workflow with Kaniko builds

- Use Kaniko to build Docker images without Docker daemon
- Fixes Docker-in-Docker issues in Gitea runner
- Supports building worker, api, and web images
- Added cache for faster builds
This commit is contained in:
fchinembiri 2026-05-04 22:36:08 +02:00
parent 208d848ab2
commit ccc3d249be
1 changed files with 42 additions and 60 deletions

View File

@ -12,78 +12,60 @@ on:
jobs: jobs:
build-worker: build-worker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 run: |
apt-get update && apt-get install -y git
git clone http://gitea.geocrop.svc.cluster.local:3000/fchinembiri/geocrop-platform.git /workspace
cd /workspace
- name: Set up Docker Buildx - name: Build Worker with Kaniko
uses: docker/setup-buildx-action@v3 run: |
cat > /kaniko_executor << 'EOF'
- name: Login to Docker Hub #!/bin/sh
uses: docker/login-action@v3 set -e
with: /kaniko/executor \
username: ${{ secrets.DOCKERHUB_USERNAME }} --dockerfile /workspace/apps/worker/Dockerfile \
password: ${{ secrets.DOCKERHUB_TOKEN }} --context /workspace \
--destination frankchine/geocrop-worker:latest \
- name: Build and push Worker Image --cache=true
uses: docker/build-push-action@v5 EOF
with: chmod +x /kaniko_executor
context: ./apps/worker /kaniko_executor
push: true
tags: |
frankchine/geocrop-worker:latest
frankchine/geocrop-worker:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-api: build-api:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 run: |
apt-get update && apt-get install -y git
git clone http://gitea.geocrop.svc.cluster.local:3000/fchinembiri/geocrop-platform.git /workspace
cd /workspace
- name: Set up Docker Buildx - name: Build API with Kaniko
uses: docker/setup-buildx-action@v3 run: |
/kaniko/executor \
- name: Login to Docker Hub --dockerfile /workspace/apps/api/Dockerfile \
uses: docker/login-action@v3 --context /workspace \
with: --destination frankchine/geocrop-api:latest \
username: ${{ secrets.DOCKERHUB_USERNAME }} --cache=true
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push API Image
uses: docker/build-push-action@v5
with:
context: ./apps/api
push: true
tags: |
frankchine/geocrop-api:latest
frankchine/geocrop-api:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-web: build-web:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 run: |
apt-get update && apt-get install -y git
git clone http://gitea.geocrop.svc.cluster.local:3000/fchinembiri/geocrop-platform.git /workspace
cd /workspace
- name: Set up Docker Buildx - name: Build Web with Kaniko
uses: docker/setup-buildx-action@v3 run: |
/kaniko/executor \
- name: Login to Docker Hub --dockerfile /workspace/apps/web/Dockerfile \
uses: docker/login-action@v3 --context /workspace \
with: --destination frankchine/geocrop-web:latest \
username: ${{ secrets.DOCKERHUB_USERNAME }} --cache=true
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Web Image
uses: docker/build-push-action@v5
with:
context: ./apps/web
push: true
tags: |
frankchine/geocrop-web:latest
frankchine/geocrop-web:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max