-
Notifications
You must be signed in to change notification settings - Fork 9
78 lines (68 loc) · 2.42 KB
/
Copy pathreusable-docker.yml
File metadata and controls
78 lines (68 loc) · 2.42 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
# Copyright 2025 AGNTCY Contributors (https://github.com/agntcy)
# SPDX-License-Identifier: Apache-2.0
---
name: Build and Push Docker Images
on:
workflow_call:
inputs:
bake-targets:
required: true
type: string
description: "Bake target"
bake-file:
required: false
type: string
description: "Bake file"
default: "./deployments/docker/docker-bake.hcl"
image-tag:
required: true
type: string
description: "Image tag to use."
image-repo:
required: false
type: string
description: "Image repo to use."
secrets:
github-token:
description: "Github token"
required: false
jobs:
build-and-push:
name: Build and Push Docker Images
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f # v4.2.0
with:
fetch-depth: 0
persist-credentials: false
- name: Login to GitHub Container Registry
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.github-token}}
- name: Setup QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Setup Buildx env
run: echo "BUILDX_BAKE_ENTITLEMENTS_FS=0" >> "$GITHUB_ENV"
- name: Docker metadata
id: metadata
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
tags: |
type=raw,value=${{ inputs.image-tag }}
type=raw,value=latest,enable=${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
- name: Build and push
uses: docker/bake-action@5be5f02ff8819ecd3092ea6b2e6261c31774f2b4 # v6.10.0
with:
files: |
${{ inputs.bake-file }}
cwd://${{ steps.metadata.outputs.bake-file }}
targets: ${{ inputs.bake-targets }}
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
env:
IMAGE_REPO: ${{ inputs.image-repo }}