-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (114 loc) · 3.79 KB
/
Copy pathdocker-build-push.yml
File metadata and controls
129 lines (114 loc) · 3.79 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Yennefer Docker Build & Push to GitHub Container Registry
name: Docker Build & Push
on:
push:
branches: [main]
paths:
- 'docker/**'
- 'genesis-q-mem/**'
- 'scripts/**'
- 'docker-compose.yennefer.yml'
- '.github/workflows/docker-build-push.yml'
workflow_dispatch:
inputs:
push_images:
description: 'Push images to GHCR'
required: true
default: 'true'
type: boolean
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: genesis-conductor-engine/yennefer
jobs:
build-and-push:
name: Build & Push Docker Images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
service:
- name: diamond-vault
dockerfile: docker/Dockerfile.diamond-vault
context: .
- name: a2a-handoff
dockerfile: docker/Dockerfile.a2a-handoff
context: .
- name: soul-api
dockerfile: docker/Dockerfile.soul-api
context: .
- name: qmem-gateway
dockerfile: docker/Dockerfile.qmem-gateway
context: .
- name: qmcp-bridge
dockerfile: docker/Dockerfile.qmcp-bridge
context: .
- name: process-guardian
dockerfile: docker/Dockerfile.process-guardian
context: .
- name: yennefer-daemon
dockerfile: docker/Dockerfile.soul-api
context: .
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.service.name }}
tags: |
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
- name: Build and push
id: build
uses: docker/build-push-action@v5
with:
context: ${{ matrix.service.context }}
file: ${{ matrix.service.dockerfile }}
push: ${{ github.event_name != 'pull_request' && (github.event.inputs.push_images != 'false') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
- name: Image digest
run: echo "Image pushed with digest ${{ steps.build.outputs.digest }}"
update-compose:
name: Update Compose with New Tags
needs: build-and-push
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update image tags
run: |
SHA=$(echo ${{ github.sha }} | cut -c1-7)
echo "Updating docker-compose.yennefer.yml with SHA: $SHA"
# Update tags in compose file (optional)
- name: Create deployment artifact
run: |
mkdir -p deployment
cp docker-compose.yennefer.yml deployment/
cp -r docker/ deployment/
cp -r .cloudflared/ deployment/ 2>/dev/null || true
tar -czf yennefer-deployment-${{ github.sha }}.tar.gz deployment/
- name: Upload deployment artifact
uses: actions/upload-artifact@v4
with:
name: yennefer-deployment
path: yennefer-deployment-*.tar.gz
retention-days: 30