Create Dockerfile #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Builds and pushes aleph-node-liminal to ECR on push to main branch | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
check-vars-and-secrets: | |
name: Check vars and secrets | |
uses: ./.github/workflows/_check-vars-and-secrets.yml | |
secrets: inherit | |
build-liminal-node: | |
needs: [check-vars-and-secrets] | |
name: Build liminal node | |
uses: ./.github/workflows/_build-liminal-node.yml | |
push-liminal-node-image-to-ecr: | |
name: Push liminal node docker image to the ECR | |
needs: [build-liminal-node] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout aleph-node sources | |
uses: actions/checkout@v4 | |
- name: Call action get-ref-properties | |
id: get-ref-properties | |
# yamllint disable-line rule:line-length | |
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v4 | |
- name: Download node production binary from artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: aleph-node-liminal | |
path: target/release/ | |
- name: Build production docker node image | |
id: build-image | |
run: | | |
chmod +x target/release/aleph-node | |
docker build --tag aleph-node-liminal:latest -f ./docker/Dockerfile . | |
- name: Login to Public Amazon ECR | |
id: login-public-ecr | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ vars.ECR_PUBLIC_HOST }} | |
username: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} | |
password: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} | |
env: | |
AWS_REGION: us-east-1 | |
- name: Push aleph-node-liminal image to ECR | |
env: | |
CURRENT_IMAGE: aleph-node-liminal | |
ECR_PUSH_IMAGE: ${{ vars.ECR_PUBLIC_REGISTRY }}aleph-node-liminal | |
COMMIT_SHA: ${{ steps.get-ref-properties.outputs.sha }} | |
run: | | |
docker tag '${{ env.CURRENT_IMAGE }}' '${{ env.ECR_PUSH_IMAGE }}:${{ env.COMMIT_SHA }}' | |
docker push '${{ env.ECR_PUSH_IMAGE }}:${{ env.COMMIT_SHA }}' | |
docker tag '${{ env.CURRENT_IMAGE }}' '${{ env.ECR_PUSH_IMAGE }}:latest' | |
docker push '${{ env.ECR_PUSH_IMAGE }}:latest' | |
send-slack-notification: | |
name: Send Slack notification about workflow status | |
runs-on: ubuntu-20.04 | |
needs: [push-liminal-node-image-to-ecr] | |
if: always() | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Send Slack message | |
uses: ./.github/actions/slack-notification | |
with: | |
notify-on: "failure" | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_DEV_ONDUTY }} |