Skip to content

Commit e316077

Browse files
k1n6b0bclaude
andcommitted
feat: Watchtower pull-based deployment via GHCR
- deploy.yml: build production stage and push to ghcr.io/hive76/beebot only (remove SSH push) - docker-compose.yml: update image refs to GHCR, add Watchtower service (polls every 5 min) - Makefile: make deploy pulls from GHCR before recreating container Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 961d0f0 commit e316077

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@ on:
66
workflow_dispatch: # allow manual trigger from GitHub UI
77

88
jobs:
9-
deploy:
10-
name: Build, Push, Deploy
9+
publish:
10+
name: Build and Push Image
1111
runs-on: ubuntu-latest
12-
# Only deploy after tests and secret scan pass
13-
needs: [] # CI runs separately; deploy is triggered by push to main
14-
# Enable branch protection to require CI to pass before merge
1512

1613
permissions:
1714
contents: read
@@ -31,19 +28,8 @@ jobs:
3128
uses: docker/build-push-action@v5
3229
with:
3330
context: .
31+
target: production
3432
push: true
3533
tags: |
3634
ghcr.io/hive76/beebot:latest
3735
ghcr.io/hive76/beebot:${{ github.sha }}
38-
39-
- name: Deploy to frame.hive76.org
40-
uses: appleboy/ssh-action@v1
41-
with:
42-
host: ${{ secrets.DEPLOY_HOST }}
43-
username: ${{ secrets.DEPLOY_USER }}
44-
key: ${{ secrets.DEPLOY_SSH_KEY }}
45-
script: |
46-
cd /opt/beebot
47-
docker compose pull
48-
docker compose up -d --remove-orphans
49-
docker image prune -f

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ VERSION := $(shell cat VERSION)
66
build:
77
docker build --target production -t beebot:$(VERSION) -t beebot:latest .
88

9-
## Deploy (or redeploy) the bot container with the latest image
9+
## Pull latest image from GHCR and redeploy
1010
deploy:
11+
docker compose pull beebot
1112
docker compose up -d --force-recreate beebot
1213

1314
## Run a one-off knowledge base sync

docker-compose.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
beebot:
3-
image: beebot:latest
3+
image: ghcr.io/hive76/beebot:latest
44
container_name: beebot
55
restart: unless-stopped
66

@@ -30,10 +30,10 @@ services:
3030
start_period: 15s
3131

3232
# Separate sync container — runs once and exits
33-
# Trigger manually in Portainer or via cron on host:
33+
# Trigger manually or via cron on host:
3434
# docker compose run --rm beebot-sync
3535
beebot-sync:
36-
image: beebot:latest
36+
image: ghcr.io/hive76/beebot:latest
3737
container_name: beebot-sync
3838
restart: "no"
3939
user: "0:0" # sync writes to the shared volume; root avoids permission issues
@@ -50,6 +50,17 @@ services:
5050

5151
command: ["python", "sync/sync_docs.py"]
5252

53+
# Watchtower — polls GHCR every 5 minutes, pulls new image, restarts beebot
54+
# Requires: docker login ghcr.io on the host (PAT with read:packages scope)
55+
watchtower:
56+
image: containrrr/watchtower
57+
container_name: watchtower
58+
restart: unless-stopped
59+
volumes:
60+
- /var/run/docker.sock:/var/run/docker.sock
61+
- /root/.docker/config.json:/config.json:ro
62+
command: --interval 300 beebot
63+
5364
volumes:
5465
beebot_data:
5566
driver: local

0 commit comments

Comments
 (0)