Skip to content

Merge pull request #37 from tokenguardio/dapp-analytics-dev #32

Merge pull request #37 from tokenguardio/dapp-analytics-dev

Merge pull request #37 from tokenguardio/dapp-analytics-dev #32

name: Build and push to ECR(tokenguard-prod)
on:
push:
branches: ['main', 'dapp-analytics-main']
pull_request:
branches: ['main', 'dapp-analytics-main']
workflow_dispatch:
env:
AWS_REGION: eu-west-1
jobs:
# run-tests:
# name: Run tests
# if: github.event_name == 'pull_request' || github.event_name == 'push'
# runs-on: ubuntu-latest
# steps:
# - name: Check out code
# uses: actions/checkout@v3
# - name: Run tests
# run: docker compose -f docker-compose-test.yml run server npm test
build-push:
name: Build and push to ECR(tokenguard-prod)
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
# needs: run-tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
# Setup hardware emulator using QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64
# Setup Docker Builderx for multi-arch images
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag and push to Amazon ECR
id: build-push-ecr
uses: docker/build-push-action@v3
with:
push: true
file: Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.login-ecr.outputs.registry }}/tokenguard-prod-dashboard-creator-server:${{ github.sha }}
- name: Image digest
run: echo ${{ steps.build-push-ecr.outputs.digest }}