-
Notifications
You must be signed in to change notification settings - Fork 172
99 lines (84 loc) · 2.81 KB
/
docker-image-build-push.yml
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
name: 'Build and publish Docker image'
on:
workflow_dispatch:
inputs:
tag:
description: 'Enter an image tag e.g v0.1.0'
required: true
repo_type:
description: 'Choose repository type'
type: choice
required: false
default: 'non-official'
options:
- official
- non-official
jobs:
build_and_push_docker_image_amd:
if: github.repository_owner == 'NethermindEth'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: 'linux/amd64'
push: true
tags: nethermindeth/juno:${{ github.event.inputs.tag }}
build_and_push_docker_image_arm:
if: github.repository_owner == 'NethermindEth'
runs-on: ubuntu-arm64-4-core
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push ARM
uses: docker/build-push-action@v6
with:
context: .
platforms: 'linux/arm64'
push: true
tags: nethermindeth/juno:${{ github.event.inputs.tag }}-arm64
- name: Cleanup self-hosted
run: |
docker system prune -af
create_and_push_official_image:
if: github.repository_owner == 'NethermindEth' && github.event.inputs.repo_type == 'official'
needs: [build_and_push_docker_image_amd, build_and_push_docker_image_arm]
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create and push manifest using buildx
run: |
docker buildx imagetools create nethermindeth/juno:${{ github.event.inputs.tag }} \
nethermindeth/juno:${{ github.event.inputs.tag }}-arm64 \
--tag nethermind/juno:${{ github.event.inputs.tag }}
- name: Clean up environment
if: always()
run: |
rm -f ${HOME}/.docker/config.json