-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (66 loc) · 2.39 KB
/
docker-build-cloud.yml
File metadata and controls
72 lines (66 loc) · 2.39 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
name: Build and Push Multi-Platform Docker Image via Docker Build Cloud
on:
workflow_call:
inputs:
image-name:
description: "Name of Docker Image (fully qualified, e.g. 'iexechub/my-image')"
required: true
type: string
image-tag:
description: "Tag to apply to the built image (e.g. '1.0.0', no v prefix)"
required: true
type: string
platforms:
description: "Comma-separated build platforms (e.g. 'linux/amd64,linux/arm64')"
required: true
type: string
cloud-builder-endpoint:
description: "Docker Build Cloud endpoint, format '<dbc-org>/<builder>'"
required: true
type: string
dockerfile:
description: "Path to the Dockerfile (e.g. './Dockerfile', './docker/Dockerfile')"
default: "Dockerfile"
type: string
context:
description: "Path to Docker Build Context"
default: "."
type: string
build-args:
description: "Docker build arguments (multiline format: KEY1=value1\nKEY2=value2)"
default: ""
type: string
secrets:
dockerhub-username:
description: "Username for Docker Hub authentication"
required: true
dockerhub-password:
description: "DockerHub PAT with Build scope (required to authenticate to Docker Build Cloud endpoint)"
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
# Login MUST run before Set up Docker Buildx so the cloud driver can
# authenticate to the Docker Build Cloud endpoint via ~/.docker/config.json.
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.dockerhub-username }}
password: ${{ secrets.dockerhub-password }}
- name: Set up Docker Buildx (Docker Build Cloud)
uses: docker/setup-buildx-action@v4
with:
driver: cloud
endpoint: ${{ inputs.cloud-builder-endpoint }}
- name: Build and push multi-platform image
uses: docker/build-push-action@v7
with:
build-args: ${{ inputs.build-args }}
context: ${{ inputs.context }}
file: ${{ inputs.dockerfile }}
platforms: ${{ inputs.platforms }}
push: true
tags: ${{ inputs.image-name }}:${{ inputs.image-tag }}