2023-09-28 12:37:07 +00:00
ARG product_version=7.3.3
ARG build_number=50
2021-02-15 20:23:46 +00:00
ARG oo_root='/var/www/onlyoffice/documentserver'
2020-03-30 15:44:55 +00:00
2021-05-16 13:40:41 +00:00
## Setup
FROM onlyoffice/documentserver:${product_version}.${build_number} as setup-stage
2020-10-18 12:36:58 +00:00
ARG product_version
ARG build_number
2021-02-15 20:23:46 +00:00
ARG oo_root
ENV PRODUCT_VERSION=${product_version}
ENV BUILD_NUMBER=${build_number}
2020-03-30 15:44:55 +00:00
2021-05-16 13:40:41 +00:00
ARG build_deps="git make g++ nodejs npm"
RUN apt-get update && apt-get install -y ${build_deps}
2022-12-18 05:41:19 +00:00
#RUN npm config set registry https://registry.npm.taobao.org
2022-05-18 09:03:45 +00:00
RUN npm install -g pkg grunt grunt-cli
2020-12-27 20:02:07 +00:00
2021-05-16 13:40:41 +00:00
WORKDIR /build
2020-03-30 15:44:55 +00:00
2022-06-30 03:52:09 +00:00
2021-05-16 13:40:41 +00:00
## Clone
FROM setup-stage as clone-stage
ARG tag=v${PRODUCT_VERSION}.${BUILD_NUMBER}
2021-02-15 20:23:46 +00:00
2021-05-16 13:40:41 +00:00
RUN git clone --quiet --branch $tag --depth 1 https://github.com/ONLYOFFICE/build_tools.git /build/build_tools
RUN git clone --quiet --branch $tag --depth 1 https://github.com/ONLYOFFICE/server.git /build/server
2020-03-30 15:44:55 +00:00
2022-10-30 08:48:24 +00:00
# Working mobile editor
RUN git clone --quiet --depth 1 https://github.com/ONLYOFFICE/sdkjs.git /build/sdkjs
RUN git clone --quiet --depth 1 https://github.com/ONLYOFFICE/web-apps.git /build/web-apps
2020-03-30 15:44:55 +00:00
2022-10-30 08:48:24 +00:00
## Build
FROM clone-stage as path-stage
2020-10-18 12:36:58 +00:00
2022-10-30 08:48:24 +00:00
# patch
COPY web-apps.patch /build/web-apps.patch
RUN cd /build/web-apps && git apply /build/web-apps.patch
2022-12-18 05:41:19 +00:00
COPY server.patch /build/server.patch
2022-12-18 05:56:14 +00:00
RUN cd /build/server && git apply --ignore-space-change --ignore-whitespace /build/server.patch
2022-12-18 05:41:19 +00:00
#COPY convertermaster.js /build/server/FileConverter/sources/convertermaster.js
#COPY license.js /build/server/Common/sources/license.js
#COPY Makefile /build/server/Makefile
#COPY server.js /build/server/DocService/sources/server.js
#COPY constants.js /build/server/Common/srouces/constants.js
#COPY tenantManager.js /build/server/Common/srouces/tenantManager.js
2021-02-15 20:23:46 +00:00
2021-05-16 13:40:41 +00:00
## Build
2022-10-30 08:48:24 +00:00
FROM path-stage as build-stage
2020-03-30 15:44:55 +00:00
2021-05-16 13:40:41 +00:00
# build server with license checks patched
2021-05-21 08:54:28 +00:00
WORKDIR /build/server
RUN make
2022-05-17 13:22:05 +00:00
RUN pkg /build/build_tools/out/linux_64/onlyoffice/documentserver/server/FileConverter --targets=node14-linux -o /build/converter
RUN pkg /build/build_tools/out/linux_64/onlyoffice/documentserver/server/DocService --targets=node14-linux --options max_old_space_size=4096 -o /build/docservice
2021-05-16 13:40:41 +00:00
2022-05-18 09:03:45 +00:00
# build web-apps with mobile editing
WORKDIR /build/web-apps/build
RUN npm install
RUN grunt
2021-05-16 13:40:41 +00:00
## Final image
2021-02-15 20:23:46 +00:00
FROM onlyoffice/documentserver:${product_version}.${build_number}
ARG oo_root
2020-03-30 15:44:55 +00:00
2022-03-24 10:14:48 +00:00
#server
2021-05-16 13:40:41 +00:00
COPY --from=build-stage /build/converter ${oo_root}/server/FileConverter/converter
2022-05-10 11:02:51 +00:00
COPY --from=build-stage /build/docservice ${oo_root}/server/DocService/docservice
2022-05-18 09:03:45 +00:00
# Restore mobile editing using an old version of mobile editor
COPY --from=build-stage /build/web-apps/deploy/web-apps/apps/documenteditor/mobile ${oo_root}/web-apps/apps/documenteditor/mobile
COPY --from=build-stage /build/web-apps/deploy/web-apps/apps/presentationeditor/mobile ${oo_root}/web-apps/apps/presentationeditor/mobile
COPY --from=build-stage /build/web-apps/deploy/web-apps/apps/spreadsheeteditor/mobile ${oo_root}/web-apps/apps/spreadsheeteditor/mobile
2023-09-28 12:14:59 +00:00
# 移除字体
RUN rm -rf /usr/share/fonts/truetype/dejavu
RUN rm -rf /usr/share/fonts/truetype/liberation
# 导入中文字体
ADD ["onlyoffice-chinese-fonts/fonts for oo6/*", "/usr/share/fonts/truetype/custom/"]
# 修正hightlight js引用问题
RUN sed -i "s/https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/2.2.2\/jquery.min.js/vendor\/jQuery-2.2.2-min\/jquery-v2.2.2-min.js/" /var/www/onlyoffice/documentserver/sdkjs-plugins/highlightcode/index.html
EXPOSE 80 443
ARG COMPANY_NAME=onlyoffice
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"]