diff --git a/.github/workflows/docker-build-develop.yml b/.github/workflows/docker-build-develop.yml index 5790d3b..c9ad1b2 100644 --- a/.github/workflows/docker-build-develop.yml +++ b/.github/workflows/docker-build-develop.yml @@ -90,13 +90,13 @@ jobs: id: buildx uses: docker/setup-buildx-action@v3 - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache/${{ runner.os }}-${{ steps.setup-buildx.outputs.name }}-${{ hashFiles('**/Dockerfile') }} - key: ${{ runner.os }}-buildx-${{ steps.vars.outputs.sha_short }}-{{ hashFiles('**/Dockerfile') }} - restore-keys: | - ${{ runner.os }}-buildx- + # - name: Cache Docker layers + # uses: actions/cache@v4 + # with: + # path: /tmp/.buildx-cache/${{ runner.os }}-${{ steps.setup-buildx.outputs.name }}-${{ hashFiles('**/Dockerfile') }} + # key: ${{ runner.os }}-buildx-${{ steps.vars.outputs.sha_short }}-{{ hashFiles('**/Dockerfile') }} + # restore-keys: | + # ${{ runner.os }}-buildx- - name: Login to DockerHub uses: docker/login-action@v3 @@ -116,6 +116,19 @@ jobs: uses: aws-actions/amazon-ecr-login@v2 with: mask-password: 'true' + + - name: Get Repository Name + id: repo-name + run: echo "REPO_NAME=$(basename $GITHUB_REPOSITORY)" >> $GITHUB_ENV + + - name: Create ECR Repository if not exists + env: + AWS_REGION: us-east-1 + REPO_NAME: ${{ env.REPO_NAME }} + run: | + aws ecr describe-repositories --repository-names $REPO_NAME --region $AWS_REGION || \ + aws ecr create-repository --repository-name $REPO_NAME --region $AWS_REGION + - name: Build & Push Docker image(s) id: docker-build @@ -123,14 +136,17 @@ jobs: with: builder: ${{ steps.buildx.outputs.name }} context: ./src - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 # TODO: Re-add `linux/arm64` file: ./src/Dockerfile push: true + provenance: false tags: | ${{ github.repository }}:develop - ${{ steps.ecr-login.outputs.registry }}/yo-api:develop - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache + ${{ steps.ecr-login.outputs.registry }}/jonfairbanks/yo-api:develop + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache + cache-from: type=gha + cache-to: type=gha,mode=max - name: Notify Slack uses: act10ns/slack@v2