Skip to content

Commit

Permalink
docker buildx build
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyek committed Mar 18, 2024
1 parent ed554fb commit 8d695c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set build params
run: |
echo "ECR_REPO_URL=${{ needs.terraform.outputs.ecr_repository_scrape_txs_url }}" >> $GITHUB_ENV
echo "IMAGE_TAG=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_DEFAULT_REGION }}
- name: Set build params
run: |
echo "ECR_REPO_URL=${{ needs.terraform.outputs.ecr_repository_scrape_txs_url }}" >> $GITHUB_ENV
echo "IMAGE_TAG=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Build, tag, and push Docker image
run: ./build/build.sh
- name: Install Serverless
Expand Down
10 changes: 6 additions & 4 deletions projects/scrape-txs/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ set -e
__dirname=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
cd $__dirname

docker build -t scrape-txs:${IMAGE_TAG} -f Dockerfile $__dirname/../
docker tag scrape-txs:${IMAGE_TAG} ${ECR_REPO_URL}:${IMAGE_TAG}

host="${ECR_REPO_URL%%/*}"
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $host

docker push ${ECR_REPO_URL}:${IMAGE_TAG}
docker buildx build \
--push -t ${ECR_REPO_URL}:${IMAGE_TAG} \
-f ./Dockerfile \
--cache-to type=gha,scope=scrape-txs,mode=max \
--cache-from type=gha,scope=scrape-txs \
$__dirname/../

0 comments on commit 8d695c6

Please sign in to comment.