feat(ci): Push built images to local registry for faster K8s pulls
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
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:
@@ -68,27 +68,23 @@ steps:
|
|||||||
event: pull_request
|
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:
|
docker-backend:
|
||||||
image: gcr.io/kaniko-project/executor:debug
|
image: gcr.io/kaniko-project/executor:debug
|
||||||
environment:
|
|
||||||
REGISTRY_USER:
|
|
||||||
from_secret: registry_username
|
|
||||||
REGISTRY_PASS:
|
|
||||||
from_secret: registry_password
|
|
||||||
commands:
|
commands:
|
||||||
- echo "{\"auths\":{\"git.spdy.io\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASS\"}}}" > /kaniko/.docker/config.json
|
|
||||||
- /kaniko/executor
|
- /kaniko/executor
|
||||||
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend
|
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend
|
||||||
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend/Dockerfile
|
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend/Dockerfile
|
||||||
--destination=git.spdy.io/creationshop/cannaiq:latest
|
--destination=10.100.9.70:5000/cannaiq/backend:latest
|
||||||
--destination=git.spdy.io/creationshop/cannaiq:sha-${CI_COMMIT_SHA:0:8}
|
--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_BUILD_VERSION=sha-${CI_COMMIT_SHA:0:8}
|
||||||
--build-arg=APP_GIT_SHA=${CI_COMMIT_SHA}
|
--build-arg=APP_GIT_SHA=${CI_COMMIT_SHA}
|
||||||
--build-arg=APP_BUILD_TIME=${CI_PIPELINE_CREATED}
|
--build-arg=APP_BUILD_TIME=${CI_PIPELINE_CREATED}
|
||||||
--build-arg=CONTAINER_IMAGE_TAG=sha-${CI_COMMIT_SHA:0:8}
|
--build-arg=CONTAINER_IMAGE_TAG=sha-${CI_COMMIT_SHA:0:8}
|
||||||
--registry-mirror=mirror.gcr.io
|
--registry-mirror=mirror.gcr.io
|
||||||
|
--insecure-registry=10.100.9.70:5000
|
||||||
--cache=true
|
--cache=true
|
||||||
depends_on: []
|
depends_on: []
|
||||||
when:
|
when:
|
||||||
@@ -97,19 +93,14 @@ steps:
|
|||||||
|
|
||||||
docker-cannaiq:
|
docker-cannaiq:
|
||||||
image: gcr.io/kaniko-project/executor:debug
|
image: gcr.io/kaniko-project/executor:debug
|
||||||
environment:
|
|
||||||
REGISTRY_USER:
|
|
||||||
from_secret: registry_username
|
|
||||||
REGISTRY_PASS:
|
|
||||||
from_secret: registry_password
|
|
||||||
commands:
|
commands:
|
||||||
- echo "{\"auths\":{\"git.spdy.io\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASS\"}}}" > /kaniko/.docker/config.json
|
|
||||||
- /kaniko/executor
|
- /kaniko/executor
|
||||||
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq
|
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq
|
||||||
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq/Dockerfile
|
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq/Dockerfile
|
||||||
--destination=git.spdy.io/creationshop/cannaiq-frontend:latest
|
--destination=10.100.9.70:5000/cannaiq/frontend:latest
|
||||||
--destination=git.spdy.io/creationshop/cannaiq-frontend:sha-${CI_COMMIT_SHA:0:8}
|
--destination=10.100.9.70:5000/cannaiq/frontend:sha-${CI_COMMIT_SHA:0:8}
|
||||||
--registry-mirror=mirror.gcr.io
|
--registry-mirror=mirror.gcr.io
|
||||||
|
--insecure-registry=10.100.9.70:5000
|
||||||
--cache=true
|
--cache=true
|
||||||
depends_on: []
|
depends_on: []
|
||||||
when:
|
when:
|
||||||
@@ -118,19 +109,14 @@ steps:
|
|||||||
|
|
||||||
docker-findadispo:
|
docker-findadispo:
|
||||||
image: gcr.io/kaniko-project/executor:debug
|
image: gcr.io/kaniko-project/executor:debug
|
||||||
environment:
|
|
||||||
REGISTRY_USER:
|
|
||||||
from_secret: registry_username
|
|
||||||
REGISTRY_PASS:
|
|
||||||
from_secret: registry_password
|
|
||||||
commands:
|
commands:
|
||||||
- echo "{\"auths\":{\"git.spdy.io\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASS\"}}}" > /kaniko/.docker/config.json
|
|
||||||
- /kaniko/executor
|
- /kaniko/executor
|
||||||
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend
|
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend
|
||||||
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend/Dockerfile
|
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend/Dockerfile
|
||||||
--destination=git.spdy.io/creationshop/findadispo-frontend:latest
|
--destination=10.100.9.70:5000/cannaiq/findadispo:latest
|
||||||
--destination=git.spdy.io/creationshop/findadispo-frontend:sha-${CI_COMMIT_SHA:0:8}
|
--destination=10.100.9.70:5000/cannaiq/findadispo:sha-${CI_COMMIT_SHA:0:8}
|
||||||
--registry-mirror=mirror.gcr.io
|
--registry-mirror=mirror.gcr.io
|
||||||
|
--insecure-registry=10.100.9.70:5000
|
||||||
--cache=true
|
--cache=true
|
||||||
depends_on: []
|
depends_on: []
|
||||||
when:
|
when:
|
||||||
@@ -139,19 +125,14 @@ steps:
|
|||||||
|
|
||||||
docker-findagram:
|
docker-findagram:
|
||||||
image: gcr.io/kaniko-project/executor:debug
|
image: gcr.io/kaniko-project/executor:debug
|
||||||
environment:
|
|
||||||
REGISTRY_USER:
|
|
||||||
from_secret: registry_username
|
|
||||||
REGISTRY_PASS:
|
|
||||||
from_secret: registry_password
|
|
||||||
commands:
|
commands:
|
||||||
- echo "{\"auths\":{\"git.spdy.io\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASS\"}}}" > /kaniko/.docker/config.json
|
|
||||||
- /kaniko/executor
|
- /kaniko/executor
|
||||||
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend
|
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend
|
||||||
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend/Dockerfile
|
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend/Dockerfile
|
||||||
--destination=git.spdy.io/creationshop/findagram-frontend:latest
|
--destination=10.100.9.70:5000/cannaiq/findagram:latest
|
||||||
--destination=git.spdy.io/creationshop/findagram-frontend:sha-${CI_COMMIT_SHA:0:8}
|
--destination=10.100.9.70:5000/cannaiq/findagram:sha-${CI_COMMIT_SHA:0:8}
|
||||||
--registry-mirror=mirror.gcr.io
|
--registry-mirror=mirror.gcr.io
|
||||||
|
--insecure-registry=10.100.9.70:5000
|
||||||
--cache=true
|
--cache=true
|
||||||
depends_on: []
|
depends_on: []
|
||||||
when:
|
when:
|
||||||
@@ -159,7 +140,7 @@ steps:
|
|||||||
event: push
|
event: push
|
||||||
|
|
||||||
# ===========================================
|
# ===========================================
|
||||||
# STAGE 3: Deploy and Run Migrations
|
# STAGE 3: Deploy to K8s (pull from local registry)
|
||||||
# ===========================================
|
# ===========================================
|
||||||
deploy:
|
deploy:
|
||||||
image: bitnami/kubectl:latest
|
image: bitnami/kubectl:latest
|
||||||
@@ -171,16 +152,15 @@ steps:
|
|||||||
- echo "$KUBECONFIG_CONTENT" | tr -d '[:space:]' | base64 -d > ~/.kube/config
|
- echo "$KUBECONFIG_CONTENT" | tr -d '[:space:]' | base64 -d > ~/.kube/config
|
||||||
- chmod 600 ~/.kube/config
|
- chmod 600 ~/.kube/config
|
||||||
# Deploy backend first
|
# 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
|
- kubectl rollout status deployment/scraper -n cannaiq --timeout=300s
|
||||||
# Note: Migrations run automatically at startup via auto-migrate
|
# Deploy workers
|
||||||
# Deploy remaining services
|
|
||||||
# Resilience: ensure workers are scaled up if at 0
|
|
||||||
- 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
|
- 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/scraper-worker worker=10.100.9.70:5000/cannaiq/backend: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
|
# Deploy frontends
|
||||||
- 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/cannaiq-frontend cannaiq-frontend=10.100.9.70:5000/cannaiq/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/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
|
- kubectl rollout status deployment/cannaiq-frontend -n cannaiq --timeout=120s
|
||||||
depends_on:
|
depends_on:
|
||||||
- docker-backend
|
- docker-backend
|
||||||
|
|||||||
Reference in New Issue
Block a user