Skip to content

Use us-east-1

Use us-east-1 #3

name: oioi-agent-image-push
on:
push:
paths:
- "oioi/agent/**"
- ".github/workflows/oioi-agent-image-push.yml"
# push:
# branches:
# - master
# pull_request:
concurrency:
group: ${{ github.ref }}-oioi-agent-image-push
cancel-in-progress: true
env:
AWS_ACCOUNT_ID: 962920162112
AWS_DEFAULT_REGION: ap-northeast-2
CDK_DEFAULT_ACCOUNT: 962920162112
CDK_DEFAULT_REGION: ap-northeast-2
permissions:
id-token: write
contents: read
jobs:
oioi-agent-image-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
with:
install: true
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/github-actions-role
aws-region: us-east-1 # for public ECR
- name: Login to Amazon ECR
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Build, tag, and push docker image to Amazon ECR Public
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
REGISTRY_ALIAS: namseent
REPOSITORY: oioi
IMAGE_TAG: ${{ github.sha }}
working-directory: oioi/agent
run: |
docker build \
-t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG \
-t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:latest \
--platform linux/amd64,linux/arm64 \
--push \
--cache-to mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$REPOSITORY:cache \
--cache-from type=registry,ref=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$REPOSITORY:cache \
.