Add multiarch build with action (#445)
* Update run-document-server.sh (#439)
* Revert "Update run-document-server.sh (#439)"
This reverts commit 5c17c711b1
.
* 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>
This commit is contained in:
parent
01606746c1
commit
a6562f4017
4 changed files with 179 additions and 2 deletions
70
.github/workflows/build-4testing.yml
vendored
Normal file
70
.github/workflows/build-4testing.yml
vendored
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
### This workflow setup instance then build and push images ###
|
||||||
|
name: Multi-arch build 4testing
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
- "!v*-stable"
|
||||||
|
|
||||||
|
env:
|
||||||
|
COMPANY_NAME: "onlyoffice"
|
||||||
|
PRODUCT_NAME: "documentserver"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
edition: ["", "-ee", "-de"]
|
||||||
|
images: ["documentserver"]
|
||||||
|
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-4testing
|
||||||
|
run: |
|
||||||
|
DOCKER_TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//' )
|
||||||
|
PACKAGE_VERSION=$(echo $DOCKER_TAG | sed 's/\./-/3')
|
||||||
|
PACKAGE_URL=${{ secrets.REPO_URL }}${{ matrix.edition }}_"$PACKAGE_VERSION"_amd64.deb
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}\n" "$PACKAGE_URL")
|
||||||
|
if [[ "$STATUS" = "200" ]]; then
|
||||||
|
echo "Have access to documentserver${{ matrix.edition }} amd64 arch >> check arm64 access"
|
||||||
|
PACKAGE_URL=${{ secrets.REPO_URL }}${{ matrix.edition }}_"$PACKAGE_VERSION"_arm64.deb
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}\n" "$PACKAGE_URL")
|
||||||
|
if [[ "$STATUS" = "200" ]]; then
|
||||||
|
echo "Have access to documentserver${{ matrix.edition }} arm64 arch"
|
||||||
|
echo "All architecture are available >> Build is starting."
|
||||||
|
sed -i "s|http://download.onlyoffice.com/install/documentserver/linux/\${COMPANY_NAME}-\${PRODUCT_NAME}\${PRODUCT_EDITION}|${{ secrets.REPO_URL }}${{ matrix.edition }}_$PACKAGE_VERSION|g" Dockerfile
|
||||||
|
PRODUCT_EDITION=${{ matrix.edition }} COMPANY_NAME=${{ env.COMPANY_NAME }} \
|
||||||
|
PRODUCT_NAME=${{ env.PRODUCT_NAME }} DOCKERFILE=Dockerfile \
|
||||||
|
PREFIX_NAME=4testing- TAG=$DOCKER_TAG \
|
||||||
|
docker buildx bake \
|
||||||
|
-f docker-bake.hcl ${{ matrix.images }} \
|
||||||
|
--push
|
||||||
|
echo "DONE: Build success >> exit with 0"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "FAILED: Have no access to some required architecture documentserver${{ matrix.edition }} >> Build did't started >> Exit with 0."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
shell: bash
|
58
.github/workflows/build-stable.yml
vendored
Normal file
58
.github/workflows/build-stable.yml
vendored
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
### 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
|
|
@ -1,4 +1,4 @@
|
||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04 as documentserver
|
||||||
LABEL maintainer Ascensio System SIA <support@onlyoffice.com>
|
LABEL maintainer Ascensio System SIA <support@onlyoffice.com>
|
||||||
|
|
||||||
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive PG_VERSION=12
|
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive PG_VERSION=12
|
||||||
|
@ -71,9 +71,11 @@ COPY run-document-server.sh /app/ds/run-document-server.sh
|
||||||
|
|
||||||
EXPOSE 80 443
|
EXPOSE 80 443
|
||||||
|
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG PRODUCT_EDITION=
|
||||||
ARG COMPANY_NAME=onlyoffice
|
ARG COMPANY_NAME=onlyoffice
|
||||||
ARG PRODUCT_NAME=documentserver
|
ARG PRODUCT_NAME=documentserver
|
||||||
ARG PACKAGE_URL="http://download.onlyoffice.com/install/documentserver/linux/${COMPANY_NAME}-${PRODUCT_NAME}_amd64.deb"
|
ARG PACKAGE_URL="http://download.onlyoffice.com/install/documentserver/linux/${COMPANY_NAME}-${PRODUCT_NAME}${PRODUCT_EDITION}_$TARGETARCH.deb"
|
||||||
|
|
||||||
ENV COMPANY_NAME=$COMPANY_NAME \
|
ENV COMPANY_NAME=$COMPANY_NAME \
|
||||||
PRODUCT_NAME=$PRODUCT_NAME
|
PRODUCT_NAME=$PRODUCT_NAME
|
||||||
|
|
47
docker-bake.hcl
Normal file
47
docker-bake.hcl
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
variable "TAG" {
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "COMPANY_NAME" {
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "PREFIX_NAME" {
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "PRODUCT_EDITION" {
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "PRODUCT_NAME" {
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "DOCKERFILE" {
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
target "documentserver" {
|
||||||
|
target = "documentserver"
|
||||||
|
dockerfile= "${DOCKERFILE}"
|
||||||
|
tags = ["docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}"]
|
||||||
|
platforms = ["linux/amd64", "linux/arm64"]
|
||||||
|
args = {
|
||||||
|
"PRODUCT_EDITION": "${PRODUCT_EDITION}"
|
||||||
|
"PRODUCT_NAME": "${PRODUCT_NAME}"
|
||||||
|
"COMPANY_NAME": "${COMPANY_NAME}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target "documentserver-stable" {
|
||||||
|
target = "documentserver-stable"
|
||||||
|
dockerfile= "${DOCKERFILE}"
|
||||||
|
tags = ["docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}", "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest"]
|
||||||
|
platforms = ["linux/amd64", "linux/arm64"]
|
||||||
|
args = {
|
||||||
|
"PRODUCT_EDITION": "${PRODUCT_EDITION}"
|
||||||
|
"PRODUCT_NAME": "${PRODUCT_NAME}"
|
||||||
|
"COMPANY_NAME": "${COMPANY_NAME}"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue