Skip to content

Instantly share code, notes, and snippets.

@korenyoni
Last active March 20, 2023 13:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save korenyoni/a5bd32da16a428477fce960060f192e9 to your computer and use it in GitHub Desktop.
Save korenyoni/a5bd32da16a428477fce960060f192e9 to your computer and use it in GitHub Desktop.
buildx to ECR
docker context create build
docker buildx create --use build --driver=docker-container
docker buildx build \
--cache-to type=gha,token=${{ secrets.GITHUB_TOKEN }} \
--cache-from type=gha,token=${{ secrets.GITHUB_TOKEN }} \
--platform=linux/amd64,linux/arm64 \
--build-arg TERRAGRUNT_VERSION=${{ env.TERRAGRUNT_VERSION }} \
--build-arg TERRAFORM_VERSION=${{ env.TERRAFORM_VERSION }} \
-t $REGISTRY/$REPOSITORY_AND_TAG \
-f container-images/$DOCKERFILE \
-o type=oci,dest=- container-images | gzip > ${{ matrix.name }}.tar.gz
Some other step...
- name: Push Container Image to ECR
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
TAG: ${{ steps.build.outputs.tag }}
run: |
cat ${{ matrix.name }}.tar.gz | docker import ${{ matrix.import_flags }} - $TAG
docker push $TAG
@korenyoni
Copy link
Author

Just a random example that came up on SweetOps office hours

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment