Docker-DocumentServer/.github/workflows/build-stable.yml
Danil Titarenko a6562f4017
Add multiarch build with action (#445)
* Update run-document-server.sh (#439)

* Revert "Update run-document-server.sh (#439)"

This reverts commit 5c17c711b1a14e39a2836bec0fee49044433c3a5.

* Add bake config

* Add targets for multiarch build

* Add multiarch workflows

* Cosmetic changes

* Refactoring

* Cosmetic changes

* Cosmetic changes

* Change URL for test repo

* Refactor: refactoring code

* Refactoring sed

* Remove -ie build

* Add special tag for package

* Cosmetic changes

Co-authored-by: papacarlo <builder@onlyoffice.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
Co-authored-by: Alexey Golubev <alexey.golubev@onlyoffice.com>
2022-06-09 13:27:39 +03:00

59 lines
2.0 KiB
YAML

### This workflow setup instance then build and push images ###
name: Multi-arch build stable
on:
push:
tags:
- "v*-stable"
env:
COMPANY_NAME: "onlyoffice"
PRODUCT_NAME: "documentserver"
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
edition: ["", "-ee", "-de"]
images: ["documentserver-stable"]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get Tag Name
id: tag_name
run: |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Build documentserver-stable
run: |
DOCKER_TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//')
IMAGE_STATUS=$(docker manifest inspect ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$DOCKER_TAG > /dev/null ; echo $?)
if [[ "$IMAGE_STATUS" = "0" ]]; then
echo "Image present on docker.hub >> start build stable version"
echo "FROM ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$DOCKER_TAG as ${{ env.PRODUCT_NAME }}-stable" >> Dockerfile.stable
PRODUCT_EDITION=${{ matrix.edition }} PRODUCT_NAME=${{ env.PRODUCT_NAME }} \
COMPANY_NAME=${{ env.COMPANY_NAME}} DOCKERFILE=Dockerfile.stable TAG=$DOCKER_TAG \
docker buildx bake \
-f docker-bake.hcl ${{ matrix.images }} \
--push ;
else
echo "FAILED: Image with tag $DOCKER_TAG do not presented on docker.hub >> build will not started >> exit with 0"
exit 0
fi
shell: bash