feat(ci): Push built images to local registry for faster K8s pulls
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

- Build images push to 10.100.9.70:5000/cannaiq/*
- Deploy pulls from local registry (no external network)
- Removed git.spdy.io registry auth (not needed for local)
- Added --insecure-registry for HTTP local registry
This commit is contained in:
Kelly
2025-12-15 19:16:16 -07:00
parent 3582c2e9e2
commit 3c10e07e45

View File

@@ -68,27 +68,23 @@ steps:
event: pull_request
# ===========================================
# MASTER DEPLOY: Parallel Docker builds (Kaniko - no Docker daemon)
# MASTER DEPLOY: Parallel Docker builds (Kaniko)
# Push to local registry (10.100.9.70:5000) for fast K8s pulls
# ===========================================
docker-backend:
image: gcr.io/kaniko-project/executor:debug
environment:
REGISTRY_USER:
from_secret: registry_username
REGISTRY_PASS:
from_secret: registry_password
commands:
- echo "{\"auths\":{\"git.spdy.io\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASS\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend/Dockerfile
--destination=git.spdy.io/creationshop/cannaiq:latest
--destination=git.spdy.io/creationshop/cannaiq:sha-${CI_COMMIT_SHA:0:8}
--destination=10.100.9.70:5000/cannaiq/backend:latest
--destination=10.100.9.70:5000/cannaiq/backend:sha-${CI_COMMIT_SHA:0:8}
--build-arg=APP_BUILD_VERSION=sha-${CI_COMMIT_SHA:0:8}
--build-arg=APP_GIT_SHA=${CI_COMMIT_SHA}
--build-arg=APP_BUILD_TIME=${CI_PIPELINE_CREATED}
--build-arg=CONTAINER_IMAGE_TAG=sha-${CI_COMMIT_SHA:0:8}
--registry-mirror=mirror.gcr.io
--insecure-registry=10.100.9.70:5000
--cache=true
depends_on: []
when:
@@ -97,19 +93,14 @@ steps:
docker-cannaiq:
image: gcr.io/kaniko-project/executor:debug
environment:
REGISTRY_USER:
from_secret: registry_username
REGISTRY_PASS:
from_secret: registry_password
commands:
- echo "{\"auths\":{\"git.spdy.io\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASS\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq/Dockerfile
--destination=git.spdy.io/creationshop/cannaiq-frontend:latest
--destination=git.spdy.io/creationshop/cannaiq-frontend:sha-${CI_COMMIT_SHA:0:8}
--destination=10.100.9.70:5000/cannaiq/frontend:latest
--destination=10.100.9.70:5000/cannaiq/frontend:sha-${CI_COMMIT_SHA:0:8}
--registry-mirror=mirror.gcr.io
--insecure-registry=10.100.9.70:5000
--cache=true
depends_on: []
when:
@@ -118,19 +109,14 @@ steps:
docker-findadispo:
image: gcr.io/kaniko-project/executor:debug
environment:
REGISTRY_USER:
from_secret: registry_username
REGISTRY_PASS:
from_secret: registry_password
commands:
- echo "{\"auths\":{\"git.spdy.io\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASS\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend/Dockerfile
--destination=git.spdy.io/creationshop/findadispo-frontend:latest
--destination=git.spdy.io/creationshop/findadispo-frontend:sha-${CI_COMMIT_SHA:0:8}
--destination=10.100.9.70:5000/cannaiq/findadispo:latest
--destination=10.100.9.70:5000/cannaiq/findadispo:sha-${CI_COMMIT_SHA:0:8}
--registry-mirror=mirror.gcr.io
--insecure-registry=10.100.9.70:5000
--cache=true
depends_on: []
when:
@@ -139,19 +125,14 @@ steps:
docker-findagram:
image: gcr.io/kaniko-project/executor:debug
environment:
REGISTRY_USER:
from_secret: registry_username
REGISTRY_PASS:
from_secret: registry_password
commands:
- echo "{\"auths\":{\"git.spdy.io\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASS\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend/Dockerfile
--destination=git.spdy.io/creationshop/findagram-frontend:latest
--destination=git.spdy.io/creationshop/findagram-frontend:sha-${CI_COMMIT_SHA:0:8}
--destination=10.100.9.70:5000/cannaiq/findagram:latest
--destination=10.100.9.70:5000/cannaiq/findagram:sha-${CI_COMMIT_SHA:0:8}
--registry-mirror=mirror.gcr.io
--insecure-registry=10.100.9.70:5000
--cache=true
depends_on: []
when:
@@ -159,7 +140,7 @@ steps:
event: push
# ===========================================
# STAGE 3: Deploy and Run Migrations
# STAGE 3: Deploy to K8s (pull from local registry)
# ===========================================
deploy:
image: bitnami/kubectl:latest
@@ -171,16 +152,15 @@ steps:
- echo "$KUBECONFIG_CONTENT" | tr -d '[:space:]' | base64 -d > ~/.kube/config
- chmod 600 ~/.kube/config
# Deploy backend first
- kubectl set image deployment/scraper scraper=git.spdy.io/creationshop/cannaiq:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
- kubectl set image deployment/scraper scraper=10.100.9.70:5000/cannaiq/backend:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
- kubectl rollout status deployment/scraper -n cannaiq --timeout=300s
# Note: Migrations run automatically at startup via auto-migrate
# Deploy remaining services
# Resilience: ensure workers are scaled up if at 0
# Deploy workers
- REPLICAS=$(kubectl get deployment scraper-worker -n cannaiq -o jsonpath='{.spec.replicas}'); if [ "$REPLICAS" = "0" ]; then echo "Scaling workers from 0 to 5"; kubectl scale deployment/scraper-worker --replicas=5 -n cannaiq; fi
- kubectl set image deployment/scraper-worker worker=git.spdy.io/creationshop/cannaiq:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
- kubectl set image deployment/cannaiq-frontend cannaiq-frontend=git.spdy.io/creationshop/cannaiq-frontend:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
- kubectl set image deployment/findadispo-frontend findadispo-frontend=git.spdy.io/creationshop/findadispo-frontend:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
- kubectl set image deployment/findagram-frontend findagram-frontend=git.spdy.io/creationshop/findagram-frontend:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
- kubectl set image deployment/scraper-worker worker=10.100.9.70:5000/cannaiq/backend:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
# Deploy frontends
- kubectl set image deployment/cannaiq-frontend cannaiq-frontend=10.100.9.70:5000/cannaiq/frontend:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
- kubectl set image deployment/findadispo-frontend findadispo-frontend=10.100.9.70:5000/cannaiq/findadispo:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
- kubectl set image deployment/findagram-frontend findagram-frontend=10.100.9.70:5000/cannaiq/findagram:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
- kubectl rollout status deployment/cannaiq-frontend -n cannaiq --timeout=120s
depends_on:
- docker-backend