Some checks failed
Build and Push to Zot / build-and-push (push) Failing after 3s
- Docker/DinD 의존성 제거 - Kubernetes Job으로 Kaniko 실행 - Zot 레지스트리로 이미지 푸시 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
name: Build and Push to Zot
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: zot0213.kro.kr
|
|
IMAGE_NAME: jovies
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: k3s-home
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Create Kaniko Job
|
|
run: |
|
|
cat <<EOF | kubectl apply -f -
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: kaniko-jovies-${GITHUB_SHA:0:7}
|
|
namespace: gitea
|
|
spec:
|
|
ttlSecondsAfterFinished: 300
|
|
backoffLimit: 0
|
|
template:
|
|
spec:
|
|
containers:
|
|
- name: kaniko
|
|
image: gcr.io/kaniko-project/executor:latest
|
|
args:
|
|
- "--context=git://github0213.com/Mayne0213/jovies.git#refs/heads/main"
|
|
- "--dockerfile=Dockerfile"
|
|
- "--context-sub-path=nextjs"
|
|
- "--destination=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
|
|
- "--destination=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_SHA}"
|
|
volumeMounts:
|
|
- name: docker-config
|
|
mountPath: /kaniko/.docker
|
|
volumes:
|
|
- name: docker-config
|
|
secret:
|
|
secretName: zot-registry-credentials
|
|
items:
|
|
- key: .dockerconfigjson
|
|
path: config.json
|
|
restartPolicy: Never
|
|
EOF
|
|
|
|
- name: Wait for Kaniko Job
|
|
run: |
|
|
kubectl wait --for=condition=complete job/kaniko-jovies-${GITHUB_SHA:0:7} -n gitea --timeout=600s || \
|
|
(kubectl logs job/kaniko-jovies-${GITHUB_SHA:0:7} -n gitea && exit 1)
|
|
|
|
- name: Cleanup
|
|
if: always()
|
|
run: |
|
|
kubectl delete job kaniko-jovies-${GITHUB_SHA:0:7} -n gitea --ignore-not-found
|