47 lines
1.6 KiB
YAML
47 lines
1.6 KiB
YAML
# CD — rebuild and restart ci-ai-bot on the Pi whenever bot/ or scripts/ change.
|
|
#
|
|
# How it works (Docker-out-of-Docker):
|
|
# 1. Job runs in docker:cli on the Pi runner (eulernest label).
|
|
# 2. Mounts the HOST docker socket → builds the new image directly in the host
|
|
# Docker daemon (no registry push needed — image is already local).
|
|
# 3. Mounts /mnt/external:ro → runs `docker compose up --force-recreate`
|
|
# which picks up the freshly built image and recreates the container.
|
|
#
|
|
# Prerequisite (one-time):
|
|
# - Runner config must list /var/run/docker.sock and /mnt/external in valid_volumes
|
|
# (set in ansible-eulernest roles/gitea_runner/templates/config.yaml.j2).
|
|
# - Set org variable JETSON_OLLAMA_URL in conformallab → Actions → Variables:
|
|
# value = http://192.168.178.103:11434/v1
|
|
name: CD — ci-ai-bot
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "bot/**"
|
|
- "scripts/**"
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: eulernest
|
|
container:
|
|
image: docker:27-cli
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- /mnt/external:/mnt/external:ro
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build ci-ai-bot image
|
|
# Build from repo root so bot/Dockerfile can COPY scripts/
|
|
run: docker build -t ci-ai-bot:latest -f bot/Dockerfile .
|
|
|
|
- name: Recreate ci-ai-bot container
|
|
# --force-recreate: always replace the container even if config is unchanged,
|
|
# so the freshly built image is picked up.
|
|
run: |
|
|
docker compose \
|
|
-f /mnt/external/docker-compose.yml \
|
|
up -d --no-deps --force-recreate ci-ai-bot
|