From 19ec72f3338a4dad8041e424adf181013a266ee9 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 00:10:00 +0300 Subject: [PATCH] ci(actions): try using docker/build-push-action no pushes yet ofc --- .github/workflows/build.yaml | 61 +++++++++++++++--------------------- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 24363f97..de237f0c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,13 +2,6 @@ name: Build images on: push: - # Publish `master` as Docker `latest` image. - branches: - - master - - # Publish `v1.2.3` tags as releases. - tags: - - v* env: BASE_IMAGE_NAME: openvk @@ -19,22 +12,15 @@ env: jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - arch: ['x86_64'] if: github.event_name == 'push' steps: - - uses: actions/checkout@v3 - with: - lfs: false - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Change repository string to lowercase id: repositorystring @@ -42,29 +28,32 @@ jobs: with: string: ${{ github.repository }} - - name: Log into registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + # - name: Log into registry + # run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Build base image - run: | - IMAGE_ID=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - [ "$VERSION" == "master" ] && VERSION=latest - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - - docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_ID:$VERSION . --push -f install/automated/docker/openvk.Dockerfile --build-arg GITREPO=${{ steps.repositorystring.outputs.lowercase }} + uses: docker/build-push-action@v6 + with: + tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME:test + platforms: linux/amd64,linux/arm64 + file: install/automated/docker/openvk.Dockerfile + build-args: | + GITREPO=${{ steps.repositorystring.outputs.lowercase }} - name: Build MariaDB primary image - run: | - IMAGE_NAME=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-primary - - docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME . --push -f install/automated/docker/mariadb-primary.Dockerfile --build-arg VERSION=$DB_VERSION + uses: docker/build-push-action@v6 + with: + tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-primary + platforms: linux/amd64,linux/arm64 + file: install/automated/docker/mariadb-primary.Dockerfile + build-args: | + VERSION=$DB_VERSION - name: Build MariaDB event image - run: | - IMAGE_NAME=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$EVENT_IMAGE_NAME:$DB_VERSION-eventdb - - docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME . --push -f install/automated/docker/mariadb-eventdb.Dockerfile --build-arg VERSION=$DB_VERSION \ No newline at end of file + uses: docker/build-push-action@v6 + with: + tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-eventdb + platforms: linux/amd64,linux/arm64 + file: install/automated/docker/mariadb-eventdb.Dockerfile + build-args: | + VERSION=$DB_VERSION