This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (66 loc) · 1.95 KB
/
build_docker_container.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
name: build_container
on:
push:
branches:
- "dev"
- "main"
# workflow_call:
# inputs:
# git_tag:
# required: true
# type: string
# docker_container_uri_str_list:
# required: true
# type: string
# index_url: # Use test pypi index when downloading from dev
# required: true
# type: string
jobs:
build_container:
runs-on: ubuntu-latest
steps:
# Checkout repo
- uses: actions/checkout@v4
# Extract branch name
- name: Extract branch name
id: get_branch_name
shell: bash
run: |
echo "branch_name=${GITHUB_REF#refs/heads/}" >> "${GITHUB_OUTPUT}"
# Get tag name
- name: Get Tag Name
id: get_tag_name
shell: bash
run: |
if [[ "${{ steps.get_branch_name.outputs.branch_name }}" == "main" ]]; then
echo "tag_name=latest" >> "${GITHUB_OUTPUT}"
else
echo "tag_name=dev" >> "${GITHUB_OUTPUT}"
fi
# Use qemu to perform multiplatform builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Use docker buildx to build multi-platform containers
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
use: true
install: true
config-inline: |
[worker.oci]
max-parallelism = 2
# Log in to GitHub Container registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
# Build and push docker images
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: ./
platforms: linux/amd64
push: true
tags: ghcr.io/umccr/cttso-ica-to-pieriandx:${{ steps.get_tag_name.outputs.tag_name }}