onlyoffice-ce-docker-license/Dockerfile

67 lines
2.8 KiB
Text
Raw Normal View History

2021-02-15 20:23:46 +00:00
## Build stage
2020-12-27 20:02:07 +00:00
ARG product_version=6.1.0
ARG build_number=83
2021-02-15 20:23:46 +00:00
ARG oo_root='/var/www/onlyoffice/documentserver'
2020-03-30 15:44:55 +00:00
2021-02-15 20:23:46 +00:00
FROM onlyoffice/documentserver:${product_version}.${build_number} as build-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-02-15 20:23:46 +00:00
# Mobile apps patching
ARG me_search='isSupportEditFeature:function(){return!1}'
ARG me_patch='s/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g'
2020-12-27 20:02:07 +00:00
2021-02-15 20:23:46 +00:00
RUN grep -q "${me_search}" ${oo_root}/web-apps/apps/documenteditor/mobile/app.js \
&& sed -si "${me_patch}" ${oo_root}/web-apps/apps/documenteditor/mobile/app.js
2020-03-30 15:44:55 +00:00
2021-02-15 20:23:46 +00:00
RUN grep -q "${me_search}" ${oo_root}/web-apps/apps/presentationeditor/mobile/app.js \
&& sed -si "${me_patch}" ${oo_root}/web-apps/apps/presentationeditor/mobile/app.js
2020-03-30 15:44:55 +00:00
2021-02-15 20:23:46 +00:00
RUN grep -q "${me_search}" ${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js \
&& sed -si "${me_patch}" ${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js
# Rebuild with license checks replaced
2020-12-27 20:02:07 +00:00
ARG build_deps="git make g++ nodejs npm"
RUN apt-get update && apt-get install -y ${build_deps}
2020-03-30 15:44:55 +00:00
2020-10-18 12:36:58 +00:00
ARG tag=v${product_version}.${build_number}
RUN mkdir /build \
2020-12-27 20:02:07 +00:00
&& git clone --quiet --branch $tag --depth 1 https://github.com/ONLYOFFICE/build_tools.git /build/build_tools \
&& git clone --quiet --branch $tag --depth 1 https://github.com/ONLYOFFICE/server.git /build/server
2020-03-30 15:44:55 +00:00
2020-10-18 12:36:58 +00:00
WORKDIR /build/server
2021-02-15 20:23:46 +00:00
RUN npm install -g pkg grunt grunt-cli
COPY license.patch /build/
RUN git apply /build/license.patch
2020-03-30 15:44:55 +00:00
2021-02-15 20:23:46 +00:00
RUN make \
2020-10-18 12:36:58 +00:00
&& pkg /build/build_tools/out/linux_64/onlyoffice/documentserver/server/FileConverter --targets=node10-linux -o /build/converter \
&& pkg /build/build_tools/out/linux_64/onlyoffice/documentserver/server/DocService --targets=node10-linux --options max_old_space_size=4096 -o /build/docservice \
2021-02-15 20:23:46 +00:00
&& cp /build/converter ${oo_root}/server/FileConverter/converter \
&& cp /build/docservice ${oo_root}/server/DocService/docservice
## Prod image
FROM onlyoffice/documentserver:${product_version}.${build_number}
ARG oo_root
2020-03-30 15:44:55 +00:00
2021-02-15 20:23:46 +00:00
COPY --from=build-stage ${oo_root}/web-apps/apps/documenteditor/mobile/app.js \
${oo_root}/web-apps/apps/documenteditor/mobile/app.js
COPY --from=build-stage ${oo_root}/web-apps/apps/presentationeditor/mobile/app.js \
${oo_root}/web-apps/apps/presentationeditor/mobile/app.js
COPY --from=build-stage ${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js \
${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js
2020-12-27 20:02:07 +00:00
2021-02-15 20:23:46 +00:00
COPY --from=build-stage ${oo_root}/server/FileConverter/converter \
${oo_root}/server/FileConverter/converter
COPY --from=build-stage ${oo_root}/server/DocService/docservice \
${oo_root}/server/DocService/docservice