This repository has been archived by the owner on Mar 31, 2024. It is now read-only.
better retry policy handling #12
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: Build and Push Docker Image | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
env: | |
ECR_REGISTRY: 767397676741.dkr.ecr.us-east-1.amazonaws.com | |
ECR_REPOSITORY: pokerai-2024 | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::767397676741:role/github-actions-role | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ hashFiles('python_skeleton/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build, tag, and push image to Amazon ECR | |
env: | |
IMAGE_TAG: ${{ github.event.repository.owner.login }}-${{ github.sha }} | |
run: | | |
docker buildx create --use | |
docker buildx build \ | |
--cache-from type=local,src=/tmp/.buildx-cache,mode=max \ | |
--cache-to type=local,dest=/tmp/.buildx-cache,mode=max \ | |
--platform linux/amd64 \ | |
--tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ | |
--file dockerfiles/python_skeleton/Dockerfile \ | |
--push . |