-
Notifications
You must be signed in to change notification settings - Fork 178
73 lines (71 loc) · 3.18 KB
/
docker_bin.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
name: Docker Image
on:
workflow_dispatch:
inputs:
guild_deploy_branch:
description: Branch to deploy
required: false
default: master
testing:
description: Testing workflow
required: false
type: boolean
default: false
push:
paths:
- 'files/docker/node/release-versions/cardano-node-latest.txt'
- 'files/docker/node/release-versions/mithril-latest.txt'
jobs:
build:
env:
REGISTRY: docker.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: docker login
run: |
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Add variables to environment
run: |
echo "G_ACCOUNT=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV
echo "CNVERSION=$(cat files/docker/node/release-versions/cardano-node-latest.txt)" >> $GITHUB_ENV
echo "PUSH_TO_GA=false" >> $GITHUB_ENV
- name: Compiling new node software suite
run: |
DOCKER_BUILDKIT=1 docker build . \
--file files/docker/node/dockerfile_bin \
--compress \
--build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \
--build-arg GUILD_DEPLOY_BRANCH=${{ github.event.inputs.guild_deploy_branch }} \
--tag ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:latest
# Workaround to provide additional free space for builds.
# https://github.com/actions/virtual-environments/issues/2840
sudo apt-get update -y
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
sudo rm -rf "/usr/share/dotnet"
sudo rm -rf "/usr/local/lib/android"
sudo rm -rf "/opt/ghc"
sudo rm -rf "/opt/hostedtoolcache/CodeQL"
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: docker push latest
if: github.event.inputs.testing == 'false' && github.event.inputs.guild_deploy_branch == 'master'
run: |
CNVERSION=`cat files/docker/node/release-versions/cardano-node-latest.txt`
echo "PUSH_TO_GA=true" >> $GITHUB_ENV
docker push ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:latest
docker tag ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:latest ${{ secrets.DOCKER_USER }}/cardano-node:${{ env.CNVERSION }}
docker push ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:${{ env.CNVERSION }}
- name: Add summary details
if: always()
run: |
echo "## Summary Details" >> $GITHUB_STEP_SUMMARY
echo "* Docker Image: ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:${{ env.CNVERSION }}" >> $GITHUB_STEP_SUMMARY
echo "* G_ACCOUNT: ${GITHUB_REPOSITORY_OWNER}" >> $GITHUB_STEP_SUMMARY
echo "* GUILD_DEPLOY_BRANCH: ${{ github.event.inputs.guild_deploy_branch }}" >> $GITHUB_STEP_SUMMARY
echo "* Push to GA Registry: ${{ env.PUSH_TO_GA }}" >> $GITHUB_STEP_SUMMARY
echo "* CNVERSION: ${{ env.CNVERSION }}" >> $GITHUB_STEP_SUMMARY