-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcallable-build-docker-image.yml
More file actions
80 lines (72 loc) · 2.88 KB
/
callable-build-docker-image.yml
File metadata and controls
80 lines (72 loc) · 2.88 KB
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
# Alexander Tebiev - https://github.com/beeyev
on:
workflow_call:
inputs:
DOCKER_REGISTRY_IMAGE:
required: true
type: string
DOCKERFILE_PATH:
required: true
type: string
PLATFORMS:
required: true
type: string
default: linux/amd64
jobs:
build-docker-image:
name: Build Docker Image
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout branch - ${{ github.head_ref || github.ref_name }}
uses: actions/checkout@v5
- name: Prepare Build Env Variables
uses: ./.github/actions/prepare-env-variables/
id: prepare-build-env-variables
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ inputs.PLATFORMS }}
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build image and push to registry - ${{ inputs.DOCKER_REGISTRY_IMAGE }}
uses: docker/build-push-action@v6
with:
platforms: ${{ inputs.PLATFORMS }}
context: .
file: ${{ inputs.DOCKERFILE_PATH }}
cache-from: type=registry,ref=${{ inputs.DOCKER_REGISTRY_IMAGE }}
cache-to: type=inline
build-args: |
BUILD_DATE=${{ steps.prepare-build-env-variables.outputs.BUILD_DATE }}
BUILD_FINGERPRINT=${{ steps.prepare-build-env-variables.outputs.BUILD_FINGERPRINT }}
tags: ${{ inputs.DOCKER_REGISTRY_IMAGE }}
push: true
labels: |
org.opencontainers.image.title="${{ github.event.repository.name }}"
org.opencontainers.image.description="${{ github.event.repository.description }}"
org.opencontainers.image.authors="${{ github.event.repository.html_url }}"
org.opencontainers.image.url="https://github.com/${{ github.repository }}"
org.opencontainers.image.source="https://github.com/${{ github.repository }}"
org.opencontainers.image.created="${{ steps.prepare-build-env-variables.outputs.NOW_RFC_3339 }}"
org.opencontainers.image.revision="${{ steps.prepare-build-env-variables.outputs.BUILD_FINGERPRINT }}"
org.opencontainers.image.vendor="${{ github.event.repository.owner.login }}"