ARG BASE_VERSION=24.04 ARG BASE_IMAGE=ubuntu:$BASE_VERSION FROM ${BASE_IMAGE} AS documentserver LABEL maintainer="ONLYOFFICE " LABEL version="9.2.0" LABEL description="ONLYOFFICE DocumentServer for ARM64 and AMD64" ARG BASE_VERSION ARG PG_VERSION=16 ARG PACKAGE_SUFFIX=t64 ENV LANG=en_US.UTF-8 \ LANGUAGE=en_US:en \ LC_ALL=en_US.UTF-8 \ DEBIAN_FRONTEND=noninteractive \ PG_VERSION=${PG_VERSION} \ BASE_VERSION=${BASE_VERSION} ARG COMPANY_NAME=onlyoffice ARG PRODUCT_NAME=documentserver ARG PRODUCT_EDITION= ARG PACKAGE_VERSION=9.2.0 ARG TARGETARCH ARG PACKAGE_BASEURL="http://download.onlyoffice.com/install/documentserver/linux" ENV COMPANY_NAME=$COMPANY_NAME \ PRODUCT_NAME=$PRODUCT_NAME \ PRODUCT_EDITION=$PRODUCT_EDITION \ DS_PLUGIN_INSTALLATION=false \ DS_DOCKER_INSTALLATION=true # Default internal DB credentials ENV DB_TYPE=postgres \ DB_HOST=localhost \ DB_PORT=5432 \ DB_NAME=onlyoffice \ DB_USER=onlyoffice \ DB_PWD=onlyoffice # Redis ENV REDIS_SERVER_HOST=localhost \ REDIS_SERVER_PORT=6379 \ REDIS_ENABLED=true # RabbitMQ ENV AMQP_SERVER_HOST=localhost \ AMQP_SERVER_PORT=5672 \ AMQP_SERVER_USER=guest \ AMQP_SERVER_PWD=guest \ AMQP_SERVER_PROTO=amqp # JWT ENV JWT_ENABLED=false \ JWT_SECRET=secret \ JWT_HEADER=Authorization \ JWT_IN_BODY=false # Other ENV WOPI_ENABLED=false \ GENERATE_FONTS=true \ METRICS_ENABLED=false \ PLUGINS_ENABLED=true \ DS_LOG_LEVEL=WARN # Allow services to start inside build RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d # Base packages RUN apt-get -y update && \ apt-get -y install wget apt-transport-https gnupg locales lsb-release && \ locale-gen en_US.UTF-8 # SQL tools repository RUN wget -q -O /etc/apt/sources.list.d/mssql-release.list \ "https://packages.microsoft.com/config/ubuntu/$BASE_VERSION/prod.list" && \ wget -q -O /tmp/microsoft.asc https://packages.microsoft.com/keys/microsoft.asc && \ apt-key add /tmp/microsoft.asc && \ gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg < /tmp/microsoft.asc # Fonts EULA RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections # Install dependencies RUN apt-get -y update && \ ACCEPT_EULA=Y apt-get -y install \ adduser apt-utils bomstrip certbot cron curl htop \ libaio1${PACKAGE_SUFFIX} libasound2${PACKAGE_SUFFIX} libboost-regex-dev \ libcairo2 libcurl3-gnutls libcurl4 libgtk-3-0 libnspr4 libnss3 libstdc++6 \ libxml2 libxss1 libxtst6 mssql-tools18 mysql-client nano net-tools \ netcat-openbsd nginx-extras postgresql postgresql-client pwgen \ rabbitmq-server redis-server sudo supervisor \ ttf-mscorefonts-installer unixodbc-dev unzip xvfb xxd zlib1g # Verify fonts RUN if [ $(find /usr/share/fonts/truetype/msttcorefonts -maxdepth 1 -type f | wc -l) -lt 20 ]; then \ echo "Fonts missing"; exit 1; \ fi # Redis bind to localhost RUN sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis/redis.conf # Add wasm MIME RUN sed 's|\(application\/zip.*\)|\1\n application\/wasm wasm;|' -i /etc/nginx/mime.types # PostgreSQL config RUN pg_conftool $PG_VERSION main set listen_addresses 'localhost' # Prepare internal PostgreSQL RUN service postgresql restart && \ sudo -u postgres psql -c "CREATE ROLE ${DB_USER} LOGIN PASSWORD '${DB_PWD}';" && \ sudo -u postgres psql -c "CREATE DATABASE ${DB_NAME} OWNER ${DB_USER};" && \ service postgresql stop # Install Oracle Instant Client RUN wget -q -O basic.zip https://download.oracle.com/otn_software/linux/instantclient/23070000/instantclient-basic-linux.$(dpkg --print-architecture | sed 's/amd64/x64/').23.7.0.0.0.25.01.zip && \ wget -q -O sqlplus.zip https://download.oracle.com/otn_software/linux/instantclient/23070000/instantclient-sqlplus-linux.$(dpkg --print-architecture | sed 's/amd64/x64/').23.7.0.0.0.25.01.zip && \ unzip -o basic.zip -d /usr/share && \ unzip -o sqlplus.zip -d /usr/share && \ mv /usr/share/instantclient_23_7 /usr/share/instantclient && \ rm -f basic.zip sqlplus.zip # Stop unwanted services RUN service postgresql stop && \ service redis-server stop && \ service rabbitmq-server stop && \ service supervisor stop && \ service nginx stop # Copy Supervisor configs & run script COPY config/supervisor/supervisor /etc/init.d/ COPY config/supervisor/ds/*.conf /etc/supervisor/conf.d/ COPY run-document-server.sh /app/ds/run-document-server.sh EXPOSE 80 443 # Install ONLYOFFICE DocumentServer package RUN PACKAGE_FILE="${COMPANY_NAME}-${PRODUCT_NAME}${PRODUCT_EDITION}${PACKAGE_VERSION:+_$PACKAGE_VERSION}_${TARGETARCH:-$(dpkg --print-architecture)}.deb" && \ wget -q -P /tmp "$PACKAGE_BASEURL/$PACKAGE_FILE" && \ apt-get -y update && \ service postgresql start && \ apt-get -y install /tmp/$PACKAGE_FILE && \ service postgresql stop && \ rm -f /tmp/$PACKAGE_FILE # Recreate ONLYOFFICE DB with proper schema RUN service postgresql start && \ sudo -u postgres psql -tc "SELECT 1 FROM pg_database WHERE datname='onlyoffice';" | grep -q 1 || \ sudo -u postgres psql -c "CREATE DATABASE onlyoffice OWNER onlyoffice;" && \ sudo -u postgres psql -d onlyoffice -f /var/www/onlyoffice/documentserver/server/schema/postgresql/createdb.sql && \ service postgresql stop VOLUME /var/log/$COMPANY_NAME \ /var/lib/$COMPANY_NAME \ /var/www/$COMPANY_NAME/Data \ /var/lib/postgresql \ /var/lib/rabbitmq \ /var/lib/redis \ /usr/share/fonts/truetype/custom ENTRYPOINT ["/app/ds/run-document-server.sh"]