use docker buildx #16
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
run: | | |
docker buildx create --use | |
- name: Set date | |
id: date | |
run: echo "::set-output name=date::$(date +'%m-%d-%Y')" | |
- name: Authenticate | |
uses: docker/login-action@v1 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Build and Push TFT-ARM64 image | |
run: | | |
docker buildx build \ | |
--file ./images/Containerfile \ | |
--platform linux/arm64 \ | |
--tag quay.io/sdaniele/tft-tools:${{ steps.date.outputs.date }}-aarch64 \ | |
--push . | |
- name: Create and Push Multi-Architecture Manifest | |
run: | | |
apt-get install -y buildah | |
buildah manifest create quay.io/sdaniele/tft-tools:${{ steps.date.outputs.date }} | |
buildah manifest add quay.io/sdaniele/tft-tools quay.io/sdaniele/tft-tools:${{ steps.date.outputs.date }}-x86_64 | |
buildah manifest add quay.io/sdaniele/tft-tools quay.io/sdaniele/tft-tools:${{ steps.date.outputs.date }}-aarch64 | |
buildah manifests push --all quay.io/sdaniele/tft-tools:${{ steps.date.outputs.date }} docker://quay.io/sdaniele/tft-tools:${{ steps.date.outputs.date }} |