Switch to Kaniko for container builds
Some checks failed
Build and Push Backend / build (push) Failing after 5s
Some checks failed
Build and Push Backend / build (push) Failing after 5s
Kaniko doesn't require Docker daemon, works better in K8s Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,48 +5,31 @@ on:
|
|||||||
branches: [main, develop]
|
branches: [main, develop]
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: gcr.io/kaniko-project/executor:debug
|
||||||
|
options: --privileged
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Prepare Kaniko config
|
||||||
uses: docker/setup-buildx-action@v3
|
run: |
|
||||||
|
mkdir -p /kaniko/.docker
|
||||||
|
echo "{\"auths\":{\"git.fuq.tv\":{\"auth\":\"$(echo -n admin:${{ secrets.REGISTRY_TOKEN }} | base64)\"}}}" > /kaniko/.docker/config.json
|
||||||
|
|
||||||
- name: Extract metadata
|
- name: Build and push with Kaniko
|
||||||
id: meta
|
run: |
|
||||||
uses: docker/metadata-action@v5
|
/kaniko/executor \
|
||||||
with:
|
--context=$GITHUB_WORKSPACE \
|
||||||
images: git.fuq.tv/admin/aiworker-backend
|
--dockerfile=Dockerfile \
|
||||||
tags: |
|
--destination=git.fuq.tv/admin/aiworker-backend:latest \
|
||||||
type=ref,event=branch
|
--destination=git.fuq.tv/admin/aiworker-backend:${GITHUB_SHA::7} \
|
||||||
type=ref,event=pr
|
--cache=true \
|
||||||
type=semver,pattern={{version}}
|
--cache-repo=git.fuq.tv/admin/aiworker-backend/cache
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=sha,prefix={{branch}}-
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
|
|
||||||
- name: Login to Gitea Registry
|
- name: Image pushed
|
||||||
uses: docker/login-action@v3
|
run: echo "Image pushed to git.fuq.tv/admin/aiworker-backend:latest"
|
||||||
with:
|
|
||||||
registry: git.fuq.tv
|
|
||||||
username: admin
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=registry,ref=git.fuq.tv/admin/aiworker-backend:buildcache
|
|
||||||
cache-to: type=registry,ref=git.fuq.tv/admin/aiworker-backend:buildcache,mode=max
|
|
||||||
|
|
||||||
- name: Image digest
|
|
||||||
run: echo ${{ steps.meta.outputs.tags }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user