-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (107 loc) · 4.03 KB
/
Copy pathdocker-dev.yml
File metadata and controls
126 lines (107 loc) · 4.03 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Docker Dev
on:
workflow_dispatch:
env:
CNB_REPOSITORY: "dbxio.com/dbx"
CNB_REGISTRY: "docker.cnb.cool"
jobs:
docker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform: [linux/amd64, linux/arm64]
steps:
- uses: actions/checkout@v5
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to CNB Registry
uses: docker/login-action@v3
with:
registry: ${{ env.CNB_REGISTRY }}
username: cnb
password: ${{ secrets.CNB_TOKEN }}
- name: Build and push Docker Hub by digest
id: build-dockerhub
uses: docker/build-push-action@v6
with:
context: .
file: deploy/Dockerfile
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/dbx,push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=${{ matrix.platform }}-dev
cache-to: type=gha,scope=${{ matrix.platform }}-dev,mode=max
- name: Build and push CNB by digest
id: build-cnb
uses: docker/build-push-action@v6
with:
context: .
file: deploy/Dockerfile
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ env.CNB_REGISTRY }}/${{ env.CNB_REPOSITORY }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=${{ matrix.platform }}-dev
- name: Export digests
run: |
mkdir -p /tmp/digests/dockerhub /tmp/digests/cnb
dockerhub_digest="${{ steps.build-dockerhub.outputs.digest }}"
cnb_digest="${{ steps.build-cnb.outputs.digest }}"
touch "/tmp/digests/dockerhub/${dockerhub_digest#sha256:}"
touch "/tmp/digests/cnb/${cnb_digest#sha256:}"
- name: Upload Docker Hub digest
uses: actions/upload-artifact@v7
with:
name: dockerhub-digests-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
path: /tmp/digests/dockerhub/*
if-no-files-found: error
retention-days: 1
- name: Upload CNB digest
uses: actions/upload-artifact@v7
with:
name: cnb-digests-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
path: /tmp/digests/cnb/*
if-no-files-found: error
retention-days: 1
docker-manifest:
needs: docker
runs-on: ubuntu-latest
steps:
- name: Download Docker Hub digests
uses: actions/download-artifact@v8
with:
path: /tmp/digests/dockerhub
pattern: dockerhub-digests-*
merge-multiple: true
- name: Download CNB digests
uses: actions/download-artifact@v8
with:
path: /tmp/digests/cnb
pattern: cnb-digests-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to CNB Registry
uses: docker/login-action@v3
with:
registry: ${{ env.CNB_REGISTRY }}
username: cnb
password: ${{ secrets.CNB_TOKEN }}
- name: Create manifest list and push
run: |
docker buildx imagetools create \
-t ${{ secrets.DOCKERHUB_USERNAME }}/dbx:dev \
$(cd /tmp/digests/dockerhub && printf '${{ secrets.DOCKERHUB_USERNAME }}/dbx@sha256:%s ' *)
docker buildx imagetools create \
-t ${{ env.CNB_REGISTRY }}/${{ env.CNB_REPOSITORY }}:dev \
$(cd /tmp/digests/cnb && printf '${{ env.CNB_REGISTRY }}/${{ env.CNB_REPOSITORY }}@sha256:%s ' *)