-
-
Notifications
You must be signed in to change notification settings - Fork 197
39 lines (31 loc) · 1.03 KB
/
Copy pathself-hosted-docker-build.yml
File metadata and controls
39 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Docker Build on Self-hosted Runner
on:
push:
branches:
- dev
workflow_dispatch:
jobs:
docker-build:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Tag current image as previous
run: |
docker tag lcomplete/huntly:latest lcomplete/huntly:previous || true
continue-on-error: true
- name: Build Docker image
run: |
docker build -f Dockerfile.multistage -t lcomplete/huntly:latest .
- name: Clean up old huntly images
run: |
# 保留 latest 和 previous,删除其他 huntly 镜像
docker images lcomplete/huntly --format "table {{.Repository}}:{{.Tag}}" | grep -v "latest\|previous\|REPOSITORY" | xargs -r docker rmi || true
continue-on-error: false
- name: Ensure data directory exists
run: |
mkdir -p ~/data/huntly
- name: Restart service with Docker Compose
run: |
docker compose down || true
docker compose up -d