-
-
Notifications
You must be signed in to change notification settings - Fork 438
111 lines (101 loc) · 4.24 KB
/
docker.yml
File metadata and controls
111 lines (101 loc) · 4.24 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
name: Build and publish Docker images
on:
workflow_call:
inputs:
tag:
description: "Docker image tag"
required: true
type: string
extra-tags:
description: "Extra tags to apply (comma-separated, e.g. 'latest,rc')"
required: false
type: string
ref:
description: "Git ref to checkout (defaults to triggering ref)"
required: false
type: string
jobs:
docker:
name: Build Docker (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: true
matrix:
include:
- arch: amd64
runner: buildjet-4vcpu-ubuntu-2204
- arch: arm64
runner: buildjet-4vcpu-ubuntu-2204-arm
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ inputs.ref || github.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Login to Docker Hub
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push lodestar
run: >
docker buildx build . --push
--tag chainsafe/lodestar:${{ inputs.tag }}-${{ matrix.arch }}
--platform linux/${{ matrix.arch }}
--build-arg COMMIT=$(git rev-parse HEAD)
- name: Sanity check lodestar (${{ matrix.arch }})
run: |
docker run -d --name lodestar-sanity-${{ matrix.arch }} -p 9596:9596 chainsafe/lodestar:${{ inputs.tag }}-${{ matrix.arch }} dev --rest.address 0.0.0.0
sleep 30
curl -f http://127.0.0.1:9596/eth/v1/node/version || (docker logs lodestar-sanity-${{ matrix.arch }} && exit 1)
docker stop lodestar-sanity-${{ matrix.arch }}
- name: Build and push custom Grafana
run: >
docker buildx build ./docker/grafana/ --push
--file ./docker/grafana/Dockerfile
--build-context dashboards=./dashboards
--tag chainsafe/lodestar-grafana:${{ inputs.tag }}-${{ matrix.arch }}
--platform linux/${{ matrix.arch }}
- name: Build and push custom Prometheus
run: >
docker buildx build ./docker/prometheus/ --push
--file ./docker/prometheus/Dockerfile
--tag chainsafe/lodestar-prometheus:${{ inputs.tag }}-${{ matrix.arch }}
--platform linux/${{ matrix.arch }}
docker-manifest:
name: Create Docker manifest
runs-on: ubuntu-latest
needs: docker
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Login to Docker Hub
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create and push lodestar manifest
run: |
EXTRA_TAGS=""
if [ -n "${{ inputs.extra-tags }}" ]; then
for t in $(echo "${{ inputs.extra-tags }}" | tr ',' ' '); do
EXTRA_TAGS="$EXTRA_TAGS -t chainsafe/lodestar:$t"
done
fi
docker buildx imagetools create -t chainsafe/lodestar:${{ inputs.tag }} $EXTRA_TAGS \
chainsafe/lodestar:${{ inputs.tag }}-amd64 \
chainsafe/lodestar:${{ inputs.tag }}-arm64
- name: Create and push grafana manifest
run: |
docker buildx imagetools create -t chainsafe/lodestar-grafana:${{ inputs.tag }} \
chainsafe/lodestar-grafana:${{ inputs.tag }}-amd64 \
chainsafe/lodestar-grafana:${{ inputs.tag }}-arm64
- name: Create and push prometheus manifest
run: |
docker buildx imagetools create -t chainsafe/lodestar-prometheus:${{ inputs.tag }} \
chainsafe/lodestar-prometheus:${{ inputs.tag }}-amd64 \
chainsafe/lodestar-prometheus:${{ inputs.tag }}-arm64
- name: Verify lodestar manifest
run: |
docker pull chainsafe/lodestar:${{ inputs.tag }}
docker image history chainsafe/lodestar:${{ inputs.tag }}