forked from mit-dci/opencbdc-tx
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (129 loc) · 4.96 KB
/
docker-merge.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
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
143
144
---
name: docker merge
# Runs on push to trunk and when pull requests are merged into trunk
on:
push:
branches:
- 'trunk'
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
########################
# CI Setup #
########################
- name: Checkout code
uses: actions/checkout@v3
########################
# Build Base #
########################
- name: Docker meta base (merge)
id: meta-base
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}-base
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Set up QEMU (merge)
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx (merge)
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry (merge)
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push base (merge)
uses: docker/build-push-action@v2
with:
context: .
target: base
push: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
tags: ${{ steps.meta-base.outputs.tags }}
labels: ${{ steps.meta-base.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
########################
# Submodules #
########################
- name: Pull submodules
run: git submodule init && git submodule update
########################
# Build Application #
########################
- name: Docker meta twophase (merge)
id: meta-twophase
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}-twophase
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Docker meta atomizer (merge)
id: meta-atomizer
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}-atomizer
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Docker meta parsec (merge)
id: meta-parsec
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}-parsec
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Build and push twophase (merge)
uses: docker/build-push-action@v2
with:
context: .
target: twophase
push: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
tags: ${{ steps.meta-twophase.outputs.tags }}
labels: ${{ steps.meta-twophase.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push atomizer (merge)
uses: docker/build-push-action@v2
with:
context: .
target: atomizer
push: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
tags: ${{ steps.meta-atomizer.outputs.tags }}
labels: ${{ steps.meta-atomizer.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push parsec (merge)
uses: docker/build-push-action@v2
with:
context: .
target: parsec
push: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
tags: ${{ steps.meta-parsec.outputs.tags }}
labels: ${{ steps.meta-parsec.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max