359ce8928a
CI/CD / build-and-push (push) Failing after 4m22s
BuildKit docker-container driver runs isolated from DinD daemon config, so it needs its own mirror declaration to route docker.io pulls through the cluster-local pull-through cache instead of Cloudflare CDN directly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
104 lines
3.8 KiB
YAML
104 lines
3.8 KiB
YAML
name: CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
REGISTRY: git.chemavx.xyz
|
|
K8S_MANIFESTS_REPO: http://chemavx:${{ secrets.CI_TOKEN }}@gitea.gitea.svc.cluster.local:3000/chemavx/k8s-manifests.git
|
|
GIT_SSL_NO_VERIFY: "true"
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ssl-verify: false
|
|
|
|
- name: Set image tag
|
|
id: tag
|
|
run: echo "TAG=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Log in to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.chemavx.xyz
|
|
username: chemavx
|
|
password: ${{ secrets.CI_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
driver: docker-container
|
|
driver-opts: network=host
|
|
buildkitd-config-inline: |
|
|
[registry."git.chemavx.xyz"]
|
|
http = true
|
|
insecure = true
|
|
|
|
[registry."docker.io"]
|
|
mirrors = ["registry-cache.registry-cache.svc.cluster.local:5000"]
|
|
|
|
[registry."registry-cache.registry-cache.svc.cluster.local:5000"]
|
|
http = true
|
|
insecure = true
|
|
|
|
- name: Build and push bot image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
push: true
|
|
tags: git.chemavx.xyz/chemavx/polymarket-bot:${{ steps.tag.outputs.TAG }}
|
|
cache-from: type=registry,ref=git.chemavx.xyz/chemavx/polymarket-bot:buildcache
|
|
cache-to: type=registry,ref=git.chemavx.xyz/chemavx/polymarket-bot:buildcache,mode=max
|
|
|
|
- name: Build and push API image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
file: Dockerfile.api
|
|
push: true
|
|
tags: git.chemavx.xyz/chemavx/polymarket-bot-api:${{ steps.tag.outputs.TAG }}
|
|
cache-from: type=registry,ref=git.chemavx.xyz/chemavx/polymarket-bot-api:buildcache
|
|
cache-to: type=registry,ref=git.chemavx.xyz/chemavx/polymarket-bot-api:buildcache,mode=max
|
|
|
|
- name: Build and push dashboard image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: dashboard
|
|
file: dashboard/Dockerfile
|
|
push: true
|
|
tags: git.chemavx.xyz/chemavx/polymarket-bot-dashboard:${{ steps.tag.outputs.TAG }}
|
|
cache-from: type=registry,ref=git.chemavx.xyz/chemavx/polymarket-bot-dashboard:buildcache
|
|
cache-to: type=registry,ref=git.chemavx.xyz/chemavx/polymarket-bot-dashboard:buildcache,mode=max
|
|
|
|
- name: Update k8s manifests
|
|
run: |
|
|
TAG=${{ steps.tag.outputs.TAG }}
|
|
|
|
git config --global user.email "ci@git.chemavx.xyz"
|
|
git config --global user.name "Gitea CI"
|
|
|
|
git clone ${{ env.K8S_MANIFESTS_REPO }} /tmp/k8s-manifests
|
|
cd /tmp/k8s-manifests
|
|
|
|
sed -i "s|image: .*polymarket-bot[^-].*|image: git.chemavx.xyz/chemavx/polymarket-bot:${TAG}|g" \
|
|
polymarket-bot/deployment-bot.yaml
|
|
sed -i "s|image: .*polymarket-bot-api.*|image: git.chemavx.xyz/chemavx/polymarket-bot-api:${TAG}|g" \
|
|
polymarket-bot/deployment-api.yaml
|
|
sed -i "s|image: .*polymarket-bot-dashboard.*|image: git.chemavx.xyz/chemavx/polymarket-bot-dashboard:${TAG}|g" \
|
|
polymarket-bot/deployment-dashboard.yaml
|
|
sed -i "s|imagePullPolicy: Never|imagePullPolicy: Always|g" \
|
|
polymarket-bot/deployment-bot.yaml \
|
|
polymarket-bot/deployment-api.yaml \
|
|
polymarket-bot/deployment-dashboard.yaml
|
|
|
|
git add polymarket-bot/deployment-bot.yaml polymarket-bot/deployment-api.yaml polymarket-bot/deployment-dashboard.yaml
|
|
git diff --cached --quiet || git commit -m "ci: update polymarket-bot images to ${TAG} [skip ci]"
|
|
git push
|