From 05aa933b9aeee278ac150b671dd07dc48fd4ae0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Wed, 9 Mar 2022 16:45:56 +0100 Subject: [PATCH 1/2] Initial commit Docker build process now adds debian bullseye repositories, downloads needed arm dependencies, downloads qemu and binfmt, downloads and modifies needed amd64 libraries Change the install process of documentserver itself: Downloads package from official debian repositories, modifies dependencies, repackages it and resumes the normal install process. Package does not install from `/tmp` but from `/build` which is removed after instalation is completed `docker-compose.yml` larger stop grace period - Raspberry Pis have slow storage, set to two minutes just to be sure it doesn't get killed because of that --- Dockerfile | 57 ++++++++++++++++++++++++++++++++++++++-------- docker-compose.yml | 2 +- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8d8b2c2..9870e8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,10 @@ -FROM ubuntu:20.04 -LABEL maintainer Ascensio System SIA +FROM debian:latest +LABEL maintainer="jiriks74" + +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 + +RUN mkdir /build +RUN cd /build ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive PG_VERSION=12 @@ -31,7 +36,7 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ libxml2 \ libxss1 \ libxtst6 \ - mysql-client \ + mariadb-client \ nano \ net-tools \ netcat-openbsd \ @@ -62,7 +67,41 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ service rabbitmq-server stop && \ service supervisor stop && \ service nginx stop && \ - rm -rf /var/lib/apt/lists/* + +RUN apt install qemu binfmt-support qemu-user-static -t bullseye-backports -y + +RUN dpkg --add-architecture amd64 +RUN apt update && apt install libgcc-s1 libgcc-s1:amd64 -y + +RUN cd /build && apt download libc6:amd64 +RUN dpkg-deb -R /build/libc6*.deb /build/libc6 + +RUN sed -i 's/^Package: libc6$/Package: libc6-amd64/' /build/libc6/DEBIAN/control +RUN sed -i 's/^Depends: libgcc-s1, libcrypt1$/#Depends: libgcc-s1, libcrypt1/' /build/libc6/DEBIAN/control + +RUN rm -rf /build/libc6/usr/share/doc +RUN rm -rf /build/libc6/usr/share/lintian + +RUN dpkg-deb -b /build/libc6 /build/libc6-modified.deb +RUN dpkg -i /build/libc6-modified.deb + +RUN cd /build && apt download libstdc++6:amd64 +RUN dpkg-deb -R /build/libstdc++6*.deb /build/stdc + +RUN sed -i 's/^Depends: gcc-10-base (= 10.2.1-6), libc6 (>= 2.23), libgcc-s1 (>= 4.2)$/#Depends: gcc-10-base (= 10.2.1-6), libc6 (>= 2.23), libgcc-s1 (>= 4.2)/' /build/stdc/DEBIAN/control + +RUN dpkg-deb -b /build/stdc /build/libstdc++6-modified.deb +RUN dpkg -i /build/libstdc++6-modified.deb + +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 +RUN echo "deb https://download.onlyoffice.com/repo/debian squeeze main" | tee /etc/apt/sources.list.d/onlyoffice.list + +RUN cd /build && apt update && apt download onlyoffice-documentserver:amd64 +RUN dpkg-deb -R /build/onlyoffice-documentserver*.deb /build/onlyoffice + +RUN sed -i 's/^Depends: debconf (>= 0.5) | debconf-2.0, adduser, ca-certificates, coreutils, curl, libasound2, libcairo2, libcurl3 | libcurl4, libcurl3-gnutls, libgconf-2-4, libgtk-3-0, libstdc++6 (>= 4.8.4), libxml2, libxss1, libxtst6, logrotate, mysql-client | mariadb-client, nginx-extras (>= 1.3.13), postgresql-client (>= 9.1), pwgen, supervisor (>= 3.0b2), xvfb, zlib1g$/Depends: debconf:arm64 (>= 0.5) | debconf-2.0:arm64, adduser:arm64, ca-certificates:arm64, coreutils:arm64, curl:arm64, libasound2:arm64, libcairo2:arm64, libcurl3:arm64 | libcurl4:arm64, libcurl3-gnutls:arm64, libgconf-2-4:arm64, libgtk-3-0:arm64, libstdc++6:amd64 (>= 4.8.4), libxml2:arm64, libxss1:arm64, libxtst6:arm64, logrotate:arm64, mysql-client:arm64 | mariadb-client:arm64, nginx-extras:arm64 (>= 1.3.13), postgresql-client:arm64 (>= 9.1), pwgen:arm64, supervisor:all (>= 3.0b2), xvfb:arm64, zlib1g:arm64/' /build/onlyoffice/DEBIAN/control + +RUN dpkg-deb -b /build/onlyoffice /build/onlyoffice-documentserver-modified.deb COPY config /app/ds/setup/config/ COPY run-document-server.sh /app/ds/run-document-server.sh @@ -75,15 +114,13 @@ ARG PACKAGE_URL="http://download.onlyoffice.com/install/documentserver/linux/${C ENV COMPANY_NAME=$COMPANY_NAME \ PRODUCT_NAME=$PRODUCT_NAME - -RUN wget -q -P /tmp "$PACKAGE_URL" && \ - apt-get -y update && \ - service postgresql start && \ - apt-get -yq install /tmp/$(basename "$PACKAGE_URL") && \ + +RUN service postgresql start && \ + apt-get -yq install /build/onlyoffice-documentserver-modified.deb && \ service postgresql stop && \ service supervisor stop && \ chmod 755 /app/ds/*.sh && \ - rm -f /tmp/$(basename "$PACKAGE_URL") && \ + rm -rf /build/ && \ rm -rf /var/log/$COMPANY_NAME && \ rm -rf /var/lib/apt/lists/* diff --git a/docker-compose.yml b/docker-compose.yml index 51fafb2..c93b4b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,7 @@ services: - '443:443' stdin_open: true restart: always - stop_grace_period: 60s + stop_grace_period: 120s volumes: - /var/www/onlyoffice/Data - /var/log/onlyoffice From ba8a436cb45604f3ebea382dd62854a28062a1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Wed, 9 Mar 2022 16:55:45 +0100 Subject: [PATCH 2/2] Fix postgresql version, no line after \ --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9870e8d..120ec2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN echo "deb http://deb.debian.org/debian bullseye main contrib non-free\ndeb h RUN mkdir /build RUN cd /build -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=13 ARG ONLYOFFICE_VALUE=onlyoffice @@ -66,7 +66,7 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ service redis-server stop && \ service rabbitmq-server stop && \ service supervisor stop && \ - service nginx stop && \ + service nginx stop RUN apt install qemu binfmt-support qemu-user-static -t bullseye-backports -y