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:
parent
208d848ab2
commit
ccc3d249be
|
|
@ -12,78 +12,60 @@ on:
|
|||
jobs:
|
||||
build-worker:
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu-latest
|
||||
steps:
|
||||
- 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
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Worker Image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./apps/worker
|
||||
push: true
|
||||
tags: |
|
||||
frankchine/geocrop-worker:latest
|
||||
frankchine/geocrop-worker:${{ github.sha }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
- name: Build Worker with Kaniko
|
||||
run: |
|
||||
cat > /kaniko_executor << 'EOF'
|
||||
#!/bin/sh
|
||||
set -e
|
||||
/kaniko/executor \
|
||||
--dockerfile /workspace/apps/worker/Dockerfile \
|
||||
--context /workspace \
|
||||
--destination frankchine/geocrop-worker:latest \
|
||||
--cache=true
|
||||
EOF
|
||||
chmod +x /kaniko_executor
|
||||
/kaniko_executor
|
||||
|
||||
build-api:
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu-latest
|
||||
steps:
|
||||
- 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
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
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
|
||||
- name: Build API with Kaniko
|
||||
run: |
|
||||
/kaniko/executor \
|
||||
--dockerfile /workspace/apps/api/Dockerfile \
|
||||
--context /workspace \
|
||||
--destination frankchine/geocrop-api:latest \
|
||||
--cache=true
|
||||
|
||||
build-web:
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu-latest
|
||||
steps:
|
||||
- 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
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
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
|
||||
- name: Build Web with Kaniko
|
||||
run: |
|
||||
/kaniko/executor \
|
||||
--dockerfile /workspace/apps/web/Dockerfile \
|
||||
--context /workspace \
|
||||
--destination frankchine/geocrop-web:latest \
|
||||
--cache=true
|
||||
|
|
|
|||
Loading…
Reference in New Issue