From f070cdbd1f23437399b38f519ae12cb04e1c951c Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Fri, 13 May 2022 13:42:42 +0200 Subject: [PATCH] Add script to build and push all images for all architectures automatically This script automatically builds the newest version of the documentserver for all architectures with the correct tags and pushes everything to dockerhub automatically --- Dockerfile | 8 ++++---- build_and_push_all_images.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 build_and_push_all_images.py diff --git a/Dockerfile b/Dockerfile index 2e76392..ab28521 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM debian:bullseye +ARG ARCH= +FROM ${ARCH}debian:bullseye LABEL maintainer Ascensio System SIA RUN echo "deb http://deb.debian.org/debian bullseye main contrib non-free\ndeb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free\ndeb http://deb.debian.org/debian bullseye-updates main contrib non-free\ndeb http://deb.debian.org/debian bullseye-backports main" > /etc/apt/sources.list @@ -75,7 +76,6 @@ EXPOSE 80 443 ARG COMPANY_NAME=onlyoffice ARG PRODUCT_NAME=documentserver -ARG PACKAGE_URL="http://download.onlyoffice.com/install/documentserver/linux/${COMPANY_NAME}-${PRODUCT_NAME}_arm64.deb" ENV COMPANY_NAME=$COMPANY_NAME \ PRODUCT_NAME=$PRODUCT_NAME @@ -84,11 +84,11 @@ RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \ wget -q -P /tmp "http://download.onlyoffice.com/install/documentserver/linux/${COMPANY_NAME}-${PRODUCT_NAME}_${arch}.deb" && \ apt-get -y update && \ service postgresql start && \ - apt-get -yq install /tmp/$(basename "$PACKAGE_URL") && \ + apt-get -yq install /tmp/$(basename "${COMPANY_NAME}-${PRODUCT_NAME}_${arch}.deb") && \ service postgresql stop && \ service supervisor stop && \ chmod 755 /app/ds/*.sh && \ - rm -f /tmp/$(basename "$PACKAGE_URL") && \ + rm -f /tmp/"${COMPANY_NAME}-${PRODUCT_NAME}_${arch}.deb" && \ rm -rf /var/log/$COMPANY_NAME && \ rm -rf /var/lib/apt/lists/* diff --git a/build_and_push_all_images.py b/build_and_push_all_images.py new file mode 100644 index 0000000..aae069a --- /dev/null +++ b/build_and_push_all_images.py @@ -0,0 +1,18 @@ +import requests +import os + +response = requests.get("https://api.github.com/repos/ONLYOFFICE/DocumentServer/releases/latest") + +print('docker buildx build --push --platform linux/arm64,linux/amd64 --tag jiriks74/onlyoffice-documentserver:latest .') +os.system(f'docker buildx build --push --platform linux/arm64,linux/amd64 --tag jiriks74/onlyoffice-documentserver:latest .') +print("///////////////////////////////////////////////////////////////////////////") +print('Build and push ":latest" .........................................finished') +print("///////////////////////////////////////////////////////////////////////////") +print() + +print(f'docker buildx build --push --platform linux/arm64,linux/amd64 --tag jiriks74/onlyoffice-documentserver:{response.json()["name"].replace("ONLYOFFICE-DocumentServer-", "")} .') +os.system(f'docker buildx build --push --platform linux/arm64,linux/amd64 --tag jiriks74/onlyoffice-documentserver:{response.json()["name"].replace("ONLYOFFICE-DocumentServer-", "")} .') +print("///////////////////////////////////////////////////////////////////////////") +print(f'Build and push ":{response.json()["name"].replace("ONLYOFFICE-DocumentServer-", "")}".........................................finished') +print("///////////////////////////////////////////////////////////////////////////") +