Skip to content

Workflow file for this run

name: Build & Push Docker Image to Amazon ECR
on:
push:
branches:
- 'main'
env:
AWS_REGION: 'ap-northeast-1'
AWS_ROLE_ARN: 'arn:aws:iam::175142243308:role/tadashi-docker-scout-demo-role'
ECR_REGISTRY: '175142243308.dkr.ecr.ap-northeast-1.amazonaws.com'
REPOSITORY: 'tadashi/docker-scout-demo'
DOCKERHUB_REPOSITORY: 'tadashinemoto567/docker-scout-demo'
IMAGE_TAG: ${{ github.sha }}
jobs:
build-push-ecr:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: docker/setup-buildx-action@v3
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ env.AWS_ROLE_ARN }}
- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ env.ECR_REGISTRY }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- uses: docker/build-push-action@v6
with:
push: true
sbom: true
provenance: true
tags: |
${{ env.ECR_REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }}
${{ env.DOCKERHUB_REPOSITORY }}:${{ env.IMAGE_TAG }}
- uses: docker/scout-action@v1
with:
command: environment
image: ${{ env.DOCKERHUB_REPOSITORY }}:${{ env.IMAGE_TAG }}
environment: stg
organization: tadashinemoto567