-
Notifications
You must be signed in to change notification settings - Fork 17
72 lines (61 loc) · 1.67 KB
/
build-image.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
name: Build and Push Container Image
on:
workflow_call:
inputs:
tags:
description: 'Tag to use for the image'
type: string
required: true
default: 'dev'
permissions:
contents: read
packages: write
env:
IMAGE_REPOSITORY: wouisb/subconv
jobs:
setup:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.tag.outputs.TAG_NAME }}
steps:
- id: tag
run: |
# get tag from input (comma separated) and image_repository
new_tag=""
for tag in $(echo ${{ inputs.tags }} | tr "," "\n"); do
new_tag="$new_tag,${{ env.IMAGE_REPOSITORY }}:$tag"
done
# outupt
echo "TAG_NAME=$new_tag" >> $GITHUB_OUTPUT
build-and-push:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Cache Nuitka cache
uses: actions/cache@v4
with:
path: nuitka-cache
key: nuitka-cache
- name: Inject Nuitka cache into Docker
uses: reproducible-containers/[email protected]
with:
cache-source: nuitka-cache
cache-target: /root/.cache/Nuitka
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ needs.setup.outputs.tags }}
platforms: |
linux/amd64
linux/arm64