-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (67 loc) · 2.08 KB
/
buildx-docker.yaml
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
name: Docker buildx
env:
PLATFORMS: ${{ vars.PLATFORMS }}
on:
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]
workflow_dispatch:
inputs:
platforms:
description: What's the target platform?
type: choice
options:
- linux/amd64
- linux/arm64
- linux/amd64,linux/arm64
required: true
default: linux/amd64
jobs:
buildx-docker:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
DOCKER_IMAGE: bartbednarek/multiple-docker-build
concurrency:
group: buildx-docker-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Take target platforms from workflow_dispatch
if: github.event_name == 'workflow_dispatch'
run: echo PLATFORMS=${{ inputs.platforms }} >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Docker QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
platforms: ${{ env.PLATFORMS }}
- name: Docker local builder image
uses: docker/build-push-action@v5
with:
context: app2
file: app2/Dockerfile.builder
build-args: |
githubUser=${{ github.actor }}
githubPackagesReadToken=${{ secrets.GH_PACKAGES_READ_TOKEN }}
push: false
outputs: builder-image
- name: Docker Build & Push
uses: docker/build-push-action@v5
with:
context: app2
build-contexts: |
builder=builder-image
platforms: ${{ env.PLATFORMS }}
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
${{ env.DOCKER_IMAGE }}:${{ github.run_number }}_${{ github.run_id }}
${{ env.DOCKER_IMAGE }}:buildx-docker