-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (126 loc) · 6.08 KB
/
docker.yml
File metadata and controls
142 lines (126 loc) · 6.08 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
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Docker Builds
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:
branches: [main]
paths:
- 'asap-common/installation/**'
- 'asap-planner-rs/**'
- 'asap-summary-ingest/**'
- 'asap-query-engine/**'
- 'asap-tools/queriers/prometheus-client/**'
- 'asap-tools/data-sources/prometheus-exporters/fake_exporter/fake_exporter_rust/**'
- '.github/workflows/docker.yml'
workflow_dispatch:
inputs:
image-tag:
description: 'Tag to use for pushed images (e.g. v0.1.0, dev)'
required: true
default: 'dev'
permissions:
packages: write
contents: read
jobs:
build-images:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve image tag
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "value=${{ inputs.image-tag }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "push" ]; then
echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "value=pr-test" >> $GITHUB_OUTPUT
fi
# --- Base image (Python, fast) ---
- name: Build base image
run: |
docker build \
-t sketchdb-base:latest \
-f asap-common/installation/Dockerfile \
asap-common
- name: Push base image
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
run: |
docker tag sketchdb-base:latest ghcr.io/projectasap/asap-base:${{ steps.tag.outputs.value }}
docker tag sketchdb-base:latest ghcr.io/projectasap/asap-base:latest
docker push ghcr.io/projectasap/asap-base:${{ steps.tag.outputs.value }}
docker push ghcr.io/projectasap/asap-base:latest
# --- Planner RS (Rust) ---
- name: Build and push planner-rs
uses: docker/build-push-action@v6
with:
context: .
file: asap-planner-rs/Dockerfile
push: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
tags: |
ghcr.io/projectasap/asap-planner-rs:${{ steps.tag.outputs.value }}
ghcr.io/projectasap/asap-planner-rs:latest
cache-from: type=registry,ref=ghcr.io/projectasap/asap-planner-rs:buildcache
cache-to: ${{ (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch') && 'type=registry,ref=ghcr.io/projectasap/asap-planner-rs:buildcache,mode=max' || '' }}
# --- Summary Ingest (Python, depends on base) ---
- name: Build summary-ingest image
run: |
docker build \
-t asap-summary-ingest:local \
-f asap-summary-ingest/Dockerfile \
asap-summary-ingest
- name: Push summary-ingest image
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
run: |
docker tag asap-summary-ingest:local ghcr.io/projectasap/asap-summary-ingest:${{ steps.tag.outputs.value }}
docker tag asap-summary-ingest:local ghcr.io/projectasap/asap-summary-ingest:latest
docker push ghcr.io/projectasap/asap-summary-ingest:${{ steps.tag.outputs.value }}
docker push ghcr.io/projectasap/asap-summary-ingest:latest
# --- Prometheus Client (Python, depends on base) ---
- name: Build prometheus-client image
run: |
docker build \
-t asap-prometheus-client:local \
-f asap-tools/queriers/prometheus-client/Dockerfile \
asap-tools/queriers/prometheus-client
- name: Push prometheus-client image
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
run: |
docker tag asap-prometheus-client:local ghcr.io/projectasap/asap-prometheus-client:${{ steps.tag.outputs.value }}
docker tag asap-prometheus-client:local ghcr.io/projectasap/asap-prometheus-client:latest
docker push ghcr.io/projectasap/asap-prometheus-client:${{ steps.tag.outputs.value }}
docker push ghcr.io/projectasap/asap-prometheus-client:latest
# --- Fake Exporter (Rust) ---
- name: Build and push fake-exporter
uses: docker/build-push-action@v6
with:
context: asap-tools/data-sources/prometheus-exporters/fake_exporter/fake_exporter_rust/fake_exporter
file: asap-tools/data-sources/prometheus-exporters/fake_exporter/fake_exporter_rust/fake_exporter/Dockerfile
push: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
tags: |
ghcr.io/projectasap/asap-fake-exporter:${{ steps.tag.outputs.value }}
ghcr.io/projectasap/asap-fake-exporter:latest
cache-from: type=registry,ref=ghcr.io/projectasap/asap-fake-exporter:buildcache
cache-to: ${{ (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch') && 'type=registry,ref=ghcr.io/projectasap/asap-fake-exporter:buildcache,mode=max' || '' }}
# --- Query Engine (Rust, slow — uses GHCR layer cache) ---
- name: Build and push query-engine
uses: docker/build-push-action@v6
with:
context: .
file: asap-query-engine/Dockerfile
push: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
tags: |
ghcr.io/projectasap/asap-query-engine:${{ steps.tag.outputs.value }}
ghcr.io/projectasap/asap-query-engine:latest
cache-from: type=registry,ref=ghcr.io/projectasap/asap-query-engine:buildcache
cache-to: ${{ (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch') && 'type=registry,ref=ghcr.io/projectasap/asap-query-engine:buildcache,mode=max' || '' }}