-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (55 loc) · 2.22 KB
/
build-merlin.yaml
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
name: build merlin (and other manual Dockerfile)
on:
workflow_dispatch:
# Always test on pull request
# pull_request: []
# Deploy on merge to main
# push:
# branches:
# - main
jobs:
build:
runs-on: ubuntu-latest
name: Build Containers
strategy:
fail-fast: false
matrix:
container: [["merlin-demos/Dockerfile", 'ghcr.io/rse-ops/merlin-demos:merlin'],
["merlin-demos/Dockerfile.flux", 'ghcr.io/rse-ops/merlin-demos-flux:merlin'],
["merlin-demos/Dockerfile.rabbitmq", 'ghcr.io/rse-ops/merlin-demos:rabbitmq'],
["merlin-demos/Dockerfile.rabbitmq-fluxuser", 'ghcr.io/rse-ops/merlin-demos-flux:rabbitmq'],
["merlin-demos/Dockerfile.redis", 'ghcr.io/rse-ops/merlin-demos:redis'],
["merlin-demos-certs/Dockerfile", 'ghcr.io/rse-ops/merlin-demos-certs:merlin'],
["merlin-demos-certs/Dockerfile.flux", 'ghcr.io/rse-ops/merlin-demos-certs-flux:merlin'],
["merlin-demos-certs/Dockerfile.rabbitmq", 'ghcr.io/rse-ops/merlin-demos-certs:rabbitmq'],
["merlin-demos-certs/Dockerfile.redis", 'ghcr.io/rse-ops/merlin-demos-certs:redis']]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Make Space For Build
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
- name: Build and Tag Container
env:
path: ${{ matrix.container[0]}}
container: ${{ matrix.container[1]}}
run: |
dirname=$(dirname ${path})
dockerfile=$(basename ${path})
# root needs to be active user for Flux Operator
if [[ "${path}" == "merlin-demos-certs/Dockerfile" ]]; then
echo "USER root" >> ${path}
fi
cd $dirname
echo "Building ${container} in ${dirname}"
docker build -f ${dockerfile} -t ${container} .
- name: Login and Deploy Container
if: (github.event_name != 'pull_request')
env:
container: ${{ matrix.container[1] }}
run: |
set -x
docker images
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker push ${container}