Skip to content

Commit

Permalink
Merge 'release/v8.2.0' into master
Browse files Browse the repository at this point in the history
# Conflicts:
#	.env
  • Loading branch information
agolybev committed Oct 17, 2024
2 parents 3ea6967 + a859ae1 commit 3e86d67
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 445 deletions.
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ PRODUCT_EDITION=
# Unless otherwise specified, the latest up-to-date version will be used
# Example:
# RELEASE_VERSION=-7.2.2
RELEASE_VERSION=-8.1.3
RELEASE_VERSION=-8.2.0

# The hash that will be appended to the ONLYOFFICE Docs version in the request URLs
DS_VERSION_HASH=1

# Prefix in the name of your repository in Docker Hub
PREFIX_NAME=docs
Expand Down
27 changes: 20 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,23 @@ on:
- "v*"

jobs:
prepare-build:
name: "Prepare build"
runs-on: ubuntu-latest
outputs:
sourceTag: ${{ steps.prepare.outputs.sourceTag }}
dsHash: ${{ steps.prepare.outputs.dsHash }}
steps:
- name: prepare-build
id: prepare
run: |
echo "sourceTag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
echo "dsHash=$(echo -n "$(date +'%Y.%m.%d-%H%M')" | md5sum | awk '{print $1}')" >> "$GITHUB_OUTPUT"
build:
name: "${{ matrix.name }} ${{ matrix.edition }}"
runs-on: ubuntu-latest
needs: [prepare-build]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -44,18 +58,17 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Get Tag Name
id: tag-name
run: |
echo "source-tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- name: "Build Docs${{ matrix.edition }}"
env:
SOURCE_TAG: ${{ steps.tag-name.outputs.source-tag }}
DS_VERSION_HASH: ${{ needs.prepare-build.outputs.dsHash }}
SOURCE_TAG: ${{ needs.prepare-build.outputs.sourceTag }}
NOPLUG_POSTFIX: ${{ matrix.postfix }}
DOCKERFILE: ${{ matrix.dockerfile }}
run: |
DOCKER_TAG=$(echo ${SOURCE_TAG} | sed 's/^.//')
: ${DS_VERSION_HASH:?Should be set!}
DS_VERSION_HASH=${DS_VERSION_HASH} \
DOCKER_TAG=$(echo ${SOURCE_TAG} | sed 's/^.//') \
PRODUCT_EDITION=${{ matrix.edition }} \
TAG=$DOCKER_TAG \
docker buildx bake \
Expand Down
35 changes: 25 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ FROM amazonlinux:2 AS ds-base
LABEL maintainer Ascensio System SIA <[email protected]>

ARG COMPANY_NAME=onlyoffice
ARG DS_VERSION_HASH
ENV COMPANY_NAME=$COMPANY_NAME \
APPLICATION_NAME=$COMPANY_NAME \
DS_VERSION_HASH=$DS_VERSION_HASH \
NODE_ENV=production-linux \
NODE_CONFIG_DIR=/etc/$COMPANY_NAME/documentserver

RUN yum install sudo -y && \
yum install shadow-utils -y && \
amazon-linux-extras install epel -y && \
yum install procps-ng tar -y && \
yum install procps-ng tar wget -y && \
wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 && \
chmod +x /usr/local/bin/dumb-init && \
groupadd --system --gid 101 ds && \
useradd --system -g ds --no-create-home --shell /sbin/nologin --uid 101 ds && \
rm -f /var/log/*log
Expand All @@ -24,14 +29,16 @@ RUN pip install redis==3.5.3

FROM ds-base AS ds-service
ARG TARGETARCH
ARG DS_VERSION_HASH
ARG PRODUCT_EDITION=
ARG RELEASE_VERSION
ARG PRODUCT_URL=https://download.onlyoffice.com/install/documentserver/linux/onlyoffice-documentserver$PRODUCT_EDITION$RELEASE_VERSION.$TARGETARCH.rpm
ENV TARGETARCH=$TARGETARCH
ENV TARGETARCH=$TARGETARCH \
DS_VERSION_HASH=$DS_VERSION_HASH
WORKDIR /ds
RUN useradd --no-create-home --shell /sbin/nologin nginx && \
yum -y updateinfo && \
yum -y install cabextract fontconfig xorg-x11-font-utils xorg-x11-server-utils wget rpm2cpio && \
yum -y install cabextract fontconfig xorg-x11-font-utils xorg-x11-server-utils rpm2cpio && \
rpm -i https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm && \
PRODUCT_URL=$(echo $PRODUCT_URL | sed "s/"$TARGETARCH"/"$(uname -m)"/g") && \
PACKAGE_NAME=$(basename "$PRODUCT_URL") && \
Expand All @@ -48,16 +55,14 @@ COPY --chown=ds:ds \
config/nginx/includes/http-common.conf \
config/nginx/includes/http-upstream.conf \
/etc/$COMPANY_NAME/documentserver/nginx/includes/
COPY --chown=ds:ds \
config/documentserver/default.json \
/etc/$COMPANY_NAME/documentserver/default.json
COPY --chown=ds:ds \
fonts/ \
/var/www/$COMPANY_NAME/documentserver/core-fonts/custom/
COPY --chown=ds:ds \
plugins/ \
/var/www/$COMPANY_NAME/documentserver/sdkjs-plugins/
RUN documentserver-generate-allfonts.sh true && \
documentserver-flush-cache.sh -h $DS_VERSION_HASH -r false && \
documentserver-pluginsmanager.sh -r false \
--update=\"/var/www/$COMPANY_NAME/documentserver/sdkjs-plugins/plugin-list-default.json\"

Expand All @@ -81,6 +86,7 @@ COPY --chown=ds:ds --chmod=644 --from=ds-service \
/etc/nginx/conf.d/
COPY --chown=ds:ds --chmod=644 --from=ds-service \
/etc/$COMPANY_NAME/documentserver*/nginx/includes/*.conf \
/etc/nginx/includes/ds-cache.conf \
/etc/nginx/includes/
COPY --chown=ds:ds --from=ds-service \
/var/www/$COMPANY_NAME/documentserver/fonts \
Expand Down Expand Up @@ -174,7 +180,7 @@ COPY --from=redis-lib \
/usr/lib/python2.7/site-packages/redis-3.5.3.dist-info
COPY docker-entrypoint.sh /usr/local/bin/
USER ds
ENTRYPOINT docker-entrypoint.sh /var/www/$COMPANY_NAME/documentserver/server/DocService/docservice
ENTRYPOINT dumb-init docker-entrypoint.sh /var/www/$COMPANY_NAME/documentserver/server/DocService/docservice
HEALTHCHECK --interval=10s --timeout=3s CMD curl -sf http://localhost:8000/index.html

FROM ds-base AS converter
Expand Down Expand Up @@ -215,7 +221,7 @@ RUN mkdir -p \
/var/lib/$COMPANY_NAME/documentserver/App_Data/docbuilder && \
chown -R ds:ds /var/lib/$COMPANY_NAME/documentserver
USER ds
ENTRYPOINT docker-entrypoint.sh /var/www/$COMPANY_NAME/documentserver/server/FileConverter/converter
ENTRYPOINT dumb-init docker-entrypoint.sh /var/www/$COMPANY_NAME/documentserver/server/FileConverter/converter

FROM node:alpine3.19 AS example
LABEL maintainer Ascensio System SIA <[email protected]>
Expand Down Expand Up @@ -264,8 +270,16 @@ ENTRYPOINT /var/www/onlyoffice/documentserver-example/docker-entrypoint.sh npm s
FROM python:3.11 AS builder
RUN pip install redis psycopg2 PyMySQL pika python-qpid-proton func_timeout requests kubernetes flask
FROM python:3.11-slim AS utils
ARG DS_VERSION_HASH
ENV DS_VERSION_HASH=$DS_VERSION_HASH
COPY --from=ds-base /usr/local/bin/dumb-init /usr/local/bin/dumb-init
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
RUN apt update && apt install -y postgresql-client default-mysql-client curl wget jq && \
RUN apt update && \
apt-get install -y wget gnupg2 lsb-release && \
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
apt-get update && \
apt install -y postgresql-client-17 default-mysql-client curl wget jq && \
curl -LO \
https://storage.googleapis.com/kubernetes-release/release/`curl \
-s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl && \
Expand All @@ -274,7 +288,8 @@ RUN apt update && apt install -y postgresql-client default-mysql-client curl wg
groupadd --system -g 1006 ds && \
useradd --system -g ds -d /home/ds -s /bin/bash -u 101 ds && \
mkdir /scripts && \
chown -R ds:ds /scripts
chown -R ds:ds /scripts && \
chmod +x /usr/local/bin/dumb-init
USER ds

FROM statsd/statsd AS metrics
Expand Down
25 changes: 16 additions & 9 deletions Dockerfile.noplugins
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ FROM amazonlinux:2 AS ds-base
LABEL maintainer Ascensio System SIA <[email protected]>

ARG COMPANY_NAME=onlyoffice
ARG DS_VERSION_HASH
ENV COMPANY_NAME=$COMPANY_NAME \
DS_VERSION_HASH=$DS_VERSION_HASH \
NODE_ENV=production-linux \
NODE_CONFIG_DIR=/etc/$COMPANY_NAME/documentserver

RUN yum install sudo -y && \
yum install shadow-utils -y && \
amazon-linux-extras install epel -y && \
yum install procps-ng tar -y && \
yum install procps-ng tar wget -y && \
wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 && \
chmod +x /usr/local/bin/dumb-init && \
groupadd --system --gid 101 ds && \
useradd --system -g ds --no-create-home --shell /sbin/nologin --uid 101 ds && \
rm -f /var/log/*log
Expand All @@ -20,14 +24,16 @@ RUN pip install redis==3.5.3

FROM ds-base AS ds-service
ARG TARGETARCH
ARG DS_VERSION_HASH
ARG PRODUCT_EDITION=
ARG RELEASE_VERSION
ARG PRODUCT_URL=https://download.onlyoffice.com/install/documentserver/linux/onlyoffice-documentserver$PRODUCT_EDITION$RELEASE_VERSION.$TARGETARCH.rpm
ENV TARGETARCH=$TARGETARCH
ENV TARGETARCH=$TARGETARCH \
DS_VERSION_HASH=$DS_VERSION_HASH
WORKDIR /ds
RUN useradd --no-create-home --shell /sbin/nologin nginx && \
yum -y updateinfo && \
yum -y install cabextract fontconfig xorg-x11-font-utils xorg-x11-server-utils wget rpm2cpio && \
yum -y install cabextract fontconfig xorg-x11-font-utils xorg-x11-server-utils rpm2cpio && \
rpm -i https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm && \
PRODUCT_URL=$(echo $PRODUCT_URL | sed "s/"$TARGETARCH"/"$(uname -m)"/g") && \
PACKAGE_NAME=$(basename "$PRODUCT_URL") && \
Expand All @@ -44,16 +50,14 @@ COPY --chown=ds:ds \
config/nginx/includes/http-common.conf \
config/nginx/includes/http-upstream.conf \
/etc/$COMPANY_NAME/documentserver/nginx/includes/
COPY --chown=ds:ds \
config/documentserver/default.json \
/etc/$COMPANY_NAME/documentserver/default.json
COPY --chown=ds:ds \
fonts/ \
/var/www/$COMPANY_NAME/documentserver/core-fonts/custom/
COPY --chown=ds:ds \
plugins/ \
/var/www/$COMPANY_NAME/documentserver/sdkjs-plugins/
RUN documentserver-generate-allfonts.sh true
RUN documentserver-generate-allfonts.sh true && \
documentserver-flush-cache.sh -h $DS_VERSION_HASH -r false

FROM ds-base AS proxy
ENV DOCSERVICE_HOST_PORT=localhost:8000 \
Expand All @@ -75,6 +79,7 @@ COPY --chown=ds:ds --chmod=644 --from=ds-service \
/etc/nginx/conf.d/
COPY --chown=ds:ds --chmod=644 --from=ds-service \
/etc/$COMPANY_NAME/documentserver*/nginx/includes/*.conf \
/etc/nginx/includes/ds-cache.conf \
/etc/nginx/includes/
COPY --chown=ds:ds --from=ds-service \
/var/www/$COMPANY_NAME/documentserver/fonts \
Expand Down Expand Up @@ -163,7 +168,7 @@ COPY --from=redis-lib \
COPY docker-entrypoint.sh /usr/local/bin/
RUN mkdir -p /var/www/$COMPANY_NAME/documentserver/sdkjs-plugins
USER ds
ENTRYPOINT docker-entrypoint.sh /var/www/$COMPANY_NAME/documentserver/server/DocService/docservice
ENTRYPOINT dumb-init docker-entrypoint.sh /var/www/$COMPANY_NAME/documentserver/server/DocService/docservice
HEALTHCHECK --interval=10s --timeout=3s CMD curl -sf http://localhost:8000/index.html

FROM ds-base AS converter
Expand Down Expand Up @@ -204,7 +209,7 @@ RUN mkdir -p \
/var/lib/$COMPANY_NAME/documentserver/App_Data/docbuilder && \
chown -R ds:ds /var/lib/$COMPANY_NAME/documentserver
USER ds
ENTRYPOINT docker-entrypoint.sh /var/www/$COMPANY_NAME/documentserver/server/FileConverter/converter
ENTRYPOINT dumb-init docker-entrypoint.sh /var/www/$COMPANY_NAME/documentserver/server/FileConverter/converter

FROM node:alpine3.19 AS example
LABEL maintainer Ascensio System SIA <[email protected]>
Expand Down Expand Up @@ -253,6 +258,8 @@ ENTRYPOINT /var/www/onlyoffice/documentserver-example/docker-entrypoint.sh npm s
FROM python:3.11 AS builder
RUN pip install redis psycopg2 PyMySQL pika python-qpid-proton func_timeout requests kubernetes flask
FROM python:3.11-slim AS utils
ARG DS_VERSION_HASH
ENV DS_VERSION_HASH=$DS_VERSION_HASH
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
RUN apt update && apt install -y postgresql-client default-mysql-client curl wget jq && \
curl -LO \
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Possible values:

If you want to use a ONLYOFFICE Docs version other than the latest one, specify the version you need in the `RELEASE_VERSION` variable. If no value is defined, the latest up-to-date version will be used.

If you are not using the script `build.sh` to build images, then change the value in the `DS_VERSION_HASH` variable at each build. This variable defines the hash that will be appended to the ONLYOFFICE Docs version in the request URLs.

If you want to build images with no plugins at all, then change the value of the `DOCKERFILE` variable to `Dockerfile.noplugins` in the `.env` file.

#### 2. Run the build
Expand Down
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export DOCKER_BUILDKIT=1
docker-compose build \
--build-arg DOCKERFILE=$DOCKERFILE \
--build-arg PRODUCT_EDITION=$PRODUCT_EDITION \
--build-arg RELEASE_VERSION=$RELEASE_VERSION
--build-arg RELEASE_VERSION=$RELEASE_VERSION \
--build-arg DS_VERSION_HASH=$(echo -n "$(date +'%Y.%m.%d-%H%M')" | md5sum | awk '{print $1}')
Loading

0 comments on commit 3e86d67

Please sign in to comment.