ci(actions): try using docker/build-push-action

no pushes yet ofc
This commit is contained in:
Alexander Minkin 2024-11-04 00:10:00 +03:00
parent 3c53564d57
commit 19ec72f333
Signed by untrusted user: WerySkok
GPG key ID: 88E9A2F3AFE44C30

View file

@ -2,13 +2,6 @@ name: Build images
on: on:
push: push:
# Publish `master` as Docker `latest` image.
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
env: env:
BASE_IMAGE_NAME: openvk BASE_IMAGE_NAME: openvk
@ -19,22 +12,15 @@ env:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
arch: ['x86_64']
if: github.event_name == 'push' if: github.event_name == 'push'
steps: steps:
- uses: actions/checkout@v3
with:
lfs: false
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
- name: Change repository string to lowercase - name: Change repository string to lowercase
id: repositorystring id: repositorystring
@ -42,29 +28,32 @@ jobs:
with: with:
string: ${{ github.repository }} string: ${{ github.repository }}
- name: Log into registry # - name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin # run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build base image - name: Build base image
run: | uses: docker/build-push-action@v6
IMAGE_ID=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME with:
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME:test
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') platforms: linux/amd64,linux/arm64
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') file: install/automated/docker/openvk.Dockerfile
[ "$VERSION" == "master" ] && VERSION=latest build-args: |
echo IMAGE_ID=$IMAGE_ID GITREPO=${{ steps.repositorystring.outputs.lowercase }}
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 }}
- name: Build MariaDB primary image - name: Build MariaDB primary image
run: | uses: docker/build-push-action@v6
IMAGE_NAME=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-primary with:
tags: 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 platforms: linux/amd64,linux/arm64
file: install/automated/docker/mariadb-primary.Dockerfile
build-args: |
VERSION=$DB_VERSION
- name: Build MariaDB event image - name: Build MariaDB event image
run: | uses: docker/build-push-action@v6
IMAGE_NAME=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$EVENT_IMAGE_NAME:$DB_VERSION-eventdb with:
tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_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 platforms: linux/amd64,linux/arm64
file: install/automated/docker/mariadb-eventdb.Dockerfile
build-args: |
VERSION=$DB_VERSION