-
Notifications
You must be signed in to change notification settings - Fork 5
60 lines (54 loc) · 1.87 KB
/
docker-build.yml
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
---
name: Task - Build & Push Docker Image
on:
workflow_dispatch:
workflow_call:
env:
PYTHON_VERSION: 3.12.4
DOCKER_REGISTRY: ghcr.io/${{ github.repository }}
jobs:
build_containers:
strategy:
matrix:
package:
[pragma-sdk, price-pusher, vrf-listener, checkpointer, merkle-maker]
runs-on: ubuntu-latest
steps:
- 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.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract package version
run: |
PKG_PATH=$(echo ${{ matrix.package }} | tr '-' '_')
export PACKAGE_VERSION=$(grep -o '".*"' ./${{ matrix.package }}/$PKG_PATH/__init__.py | tr -d '"')
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo $PACKAGE_VERSION
- name: Build and push pragma-sdk
if: matrix.package == 'pragma-sdk'
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.package }}/Dockerfile
push: true
build-args: |
PRAGMA_PACKAGE_VERSION=${{ env.PACKAGE_VERSION }}
target: production
tags: |
${{ env.DOCKER_REGISTRY }}/${{ matrix.package }}:${{ env.PACKAGE_VERSION }}
${{ env.DOCKER_REGISTRY}}/${{ matrix.package }}:latest
- name: Build and push other packages
if: matrix.package != 'pragma-sdk'
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.package }}/Dockerfile
push: true
tags: |
${{ env.DOCKER_REGISTRY }}/${{ matrix.package }}:${{ env.PACKAGE_VERSION }}
${{ env.DOCKER_REGISTRY}}/${{ matrix.package }}:latest