-
Notifications
You must be signed in to change notification settings - Fork 13
81 lines (68 loc) · 2.7 KB
/
docker-build.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
name: Build and Publish Docker
on:
release:
types:
- released
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
tag:
description: "Tag to set for the Docker Image"
required: true
jobs:
docker:
strategy:
matrix:
platform: [linux/amd64]
release: [opportunity-standalone, standard-collator]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: binary-build.yml
- name: Display structure of downloaded files
run: ls -R
- name: Artifact move - ${{ matrix.platform }} - ${{ matrix.release }}
if: ${{ matrix.platform == 'linux/amd64' }}
run: |
mv standard-substrate-linux-x86_64/${{ matrix.release }}-linux-x86_64 ./${{ matrix.release }}
- name: Artifact move - ${{ matrix.platform }} - ${{ matrix.release }}
if: ${{ matrix.platform == 'darwin/amd64' }}
run: |
mv standard-substrate-darwin-x86_64/${{ matrix.release }}-darwin-x86_64 ./${{ matrix.release }}
- name: Make executable - ${{ matrix.platform }} - ${{ matrix.release }}
run: |
chmod +x ./${{ matrix.release }}
- name: Set up Docker Buildx - ${{ matrix.platform }} - ${{ matrix.release }}
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub - ${{ matrix.platform }} - ${{ matrix.release }}
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images - ${{ matrix.platform }} - ${{ matrix.release }}
id: docker_build
uses: docker/[email protected]
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: ./docker/${{ matrix.release }}.release
platforms: ${{ matrix.platform }}
tags: |
standardprotocol/${{ matrix.release }}:${{ github.event.release.tag_name != null && github.event.release.tag_name || github.event.inputs.tag }}
standardprotocol/${{ matrix.release }}:latest
push: true
- name: Run Snyk to check for vulnerabilities - ${{ matrix.release }}
uses: snyk/actions/docker@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: standardprotocol/${{ matrix.release }}:latest
args: --file=./docker/${{ matrix.release }}.release
- name: Image digest
run: |
echo ${{ steps.docker_build.outputs.digest }}