-
-
Notifications
You must be signed in to change notification settings - Fork 37
73 lines (64 loc) · 2.05 KB
/
build-containers.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
62
63
64
65
66
67
68
69
70
71
72
73
name: Build & Deploy Docker Containers
on:
# Build on push to any branch
push: []
jobs:
deploy-images:
runs-on: ubuntu-latest
strategy:
fail-fast: false
# Just build primary Dockerfile, tag, arm and amd64 for now
matrix:
dockerfile: [[Dockerfile, linux/amd64, '']]
name: Build ${{ matrix.dockerfile[0] }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Container Tag
run: |
branch=$(echo ${GITHUB_REF##*/})
printf "Branch is ${branch}\n"
tagged="quay.io/singularity/docker2singularity:${branch}${{ matrix.dockerfile[2] }}"
if [[ "${branch}" == "master" ]]; then
container="quay.io/singularity/docker2singularity:latest${{ matrix.dockerfile[2] }}"
else
container=${tagged}
fi
echo "container=${container}" >> $GITHUB_ENV
echo "branch=${branch}" >> $GITHUB_ENV
echo "tagged=${tagged}" >> $GITHUB_ENV
- name: Log in to Quay Container Registry
if: github.event_name == 'push'
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Inspect Container Names
run: |
printf "Tagged: ${tagged}\n"
printf "Container: ${container}\n"
- name: Build
uses: docker/build-push-action@v3
if: github.event_name != 'push'
with:
file: ${{matrix.dockerfile[0]}}
platforms: ${{ matrix.dockerfile[1] }}
push: false
tags: |
${{ env.container }}
${{ env.tagged }}
- name: Build & Deploy
uses: docker/build-push-action@v3
if: github.event_name == 'push'
with:
file: ${{matrix.dockerfile[0]}}
platforms: ${{ matrix.dockerfile[1] }}
push: true
tags: |
${{ env.container }}
${{ env.tagged }}