Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
313 changes: 67 additions & 246 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions build/.docker/bundle.bake.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ==============================================================================
# MODULE DOCKERFILE
# This file is not meant to be built standalone. It is consumed by the
# docker-bake.hcl files in the parent monorepos.
#
# REQUIRED CONTEXTS:
# - server: builds from server repo
# - core: builds from core repo
# - web-apps: builds from web-apps repo
# - sdkjs: builds from sdkjs repo
# - example: builds from example repo
# ==============================================================================


FROM alpine AS bundle
ARG BUILD_ROOT=/package
# --- Copy build files
RUN mkdir -p /build/documentserver/sdkjs-plugins /build/documentserver/fonts \
/build/documentserver/server/FileConverter/lib /build/documentserver/server/tools

# --- Static content from build context (rarely changes) ---
COPY dictionaries /build/documentserver/dictionaries
COPY document-templates /build/documentserver/document-templates
COPY core-fonts /build/documentserver/core-fonts

# --- Config files
COPY build/configs/core/DoctRenderer.config /build/documentserver/server/FileConverter/bin/DoctRenderer.config
COPY server/Metrics/config/config.js /build/documentserver/server/Metrics/config/config.js


# --- Build stage outputs (change with code) ---
COPY --from=sdkjs ${BUILD_ROOT} /build/documentserver/
COPY --from=web-apps ${BUILD_ROOT} /build/documentserver/

COPY --from=core ${BUILD_ROOT}/bin/ /build/documentserver/server/FileConverter/bin/
COPY --from=core ${BUILD_ROOT}/tools/ /build/documentserver/server/tools/
COPY --from=core ${BUILD_ROOT}/*.so* /build/documentserver/server/FileConverter/lib/
COPY --from=core ${BUILD_ROOT}/tools/*.so* /build/documentserver/server/tools/

COPY --from=server ${BUILD_ROOT}/docservice /build/documentserver/server/DocService/docservice
COPY --from=server ${BUILD_ROOT}/fileconverter /build/documentserver/server/FileConverter/converter
COPY --from=server ${BUILD_ROOT}/metrics /build/documentserver/server/Metrics/metrics
COPY --from=server ${BUILD_ROOT}/adminpanel /build/documentserver/server/AdminPanel/server/adminpanel
COPY --from=server ${BUILD_ROOT}/build /build/documentserver/server/AdminPanel/client/build


COPY --from=example /example/example /build/documentserver-example/example
RUN mkdir -p /build/documentserver-example/files
COPY --from=example /example/config /build/documentserver-example/config

#COPY document-server-package/common/documentserver-example/welcome /build/documentserver-example/welcome
#RUN YEAR=$(date +"%Y") && \
# sed -i "s|{{OFFICIAL_PRODUCT_NAME}}|Community Edition|g" /build/documentserver-example/welcome/*.html && \
# find /build/documentserver-example/welcome -depth -type f \
# -exec sed -i "s_{{year}}_${YEAR}_g" {} \; && \
# sed -i "s|{{EXAMPLE_DISABLED_COMMANDS}}|sudo systemctl start ds-example|g" \
# /build/documentserver-example/welcome/example-disabled.html && \
# rm -f /build/documentserver-example/welcome/admin-disabled.html && \
# sed -i '/<!-- BEGIN ADMIN PANEL SECTION -->/,/<!-- END ADMIN PANEL SECTION -->/d' \
# /build/documentserver-example/welcome/docker.html \
# /build/documentserver-example/welcome/linux.html \
# /build/documentserver-example/welcome/linux-rpm.html \
# /build/documentserver-example/welcome/win.html


RUN mkdir -p /build/documentserver/server/Common/config/log4js

COPY server/Common/config/. /build/documentserver/server/Common/config/

RUN rm -f /build/documentserver/server/Common/config/runtime.json

COPY server/schema/. /build/documentserver/server/schema/
COPY server/license/. /build/documentserver/server/license/
COPY server/LICENSE.txt /build/documentserver/server/
COPY server/3rd-Party.txt /build/documentserver/server/
8 changes: 2 additions & 6 deletions build/.docker/develop.bake.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
# docker-bake.hcl files in the parent monorepos.
#
# REQUIRED CONTEXTS:
# - server: builds from server repo
# - core: builds from core repo
# - web-apps: builds from web-apps repo
# - sdkjs: builds from sdkjs repo
# - example: builds from example repo
# - docker: the final docker image of documentserver
# ==============================================================================

FROM finalubuntu AS develop
Expand All @@ -17,7 +13,7 @@ FROM finalubuntu AS develop

RUN apt-get update && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs npm openjdk-21-jdk wget zip brotli && \
apt-get install -y nodejs openjdk-21-jdk wget zip brotli && \
npm install -g @yao-pkg/pkg grunt-cli && \
rm -rf /var/lib/apt/lists/*

Expand Down
67 changes: 67 additions & 0 deletions build/.docker/docker.bake.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# ==============================================================================
# MODULE DOCKERFILE
# This file is not meant to be built standalone. It is consumed by the
# docker-bake.hcl files in the parent monorepos.
#
# REQUIRED CONTEXTS:
# - packages: final packages of documentserver
# ==============================================================================

#### FINAL UBUNTU ####
FROM ubuntu:24.04 AS finalubuntu
ARG PRODUCT_VERSION
ARG BUILD_ROOT=/package

ARG EO_ROOT=/var/www/euro-office/documentserver
ARG EO_LOG=/var/log/euro-office/documentserver
ARG EO_CONF=/etc/euro-office/documentserver

ENV EO_ROOT=${EO_ROOT}
ENV EO_LOG=${EO_LOG}
ENV EO_CONF=${EO_CONF}

RUN apt-get -y update && \
ACCEPT_EULA=Y apt-get -yq install \
postgresql postgresql-client redis-server rabbitmq-server \
nginx sudo gdb nginx-extras supervisor jq util-linux && \
rm -rf /var/lib/apt/lists/*

# Create the 'ds' user that is required by OnlyOffice scripts
#RUN useradd -r -s /bin/false ds || true

# --- install euro-office .deb package
ARG TARGETARCH
COPY --from=packages / /tmp/
RUN apt-get -y update && \
service postgresql start && \
service rabbitmq-server start && \
sudo -u postgres psql -c "CREATE USER eurooffice WITH password 'eurooffice';" && \
sudo -u postgres psql -c "CREATE DATABASE eurooffice OWNER eurooffice;" && \
echo "euro-office-documentserver ds/db-type string postgres" | debconf-set-selections && \
echo "euro-office-documentserver ds/db-host string localhost" | debconf-set-selections && \
echo "euro-office-documentserver ds/db-port string 5432" | debconf-set-selections && \
echo "euro-office-documentserver ds/db-user string eurooffice" | debconf-set-selections && \
echo "euro-office-documentserver ds/db-pwd password eurooffice" | debconf-set-selections && \
echo "euro-office-documentserver ds/db-name string eurooffice" | debconf-set-selections && \
DS_DOCKER_INSTALLATION=true DEBIAN_FRONTEND=noninteractive apt-get -yq install /tmp/euro-office-documentserver_${PRODUCT_VERSION}-0_${TARGETARCH}.deb
#sudo -u postgres bash -c "PGPASSWORD=eurooffice psql -h localhost -U eurooffice -d eurooffice -f ${EO_ROOT}/server/schema/postgresql/createdb.sql"


# --- Final setup ---
COPY build/configs/supervisor/ /etc/supervisor/conf.d/
COPY --chmod=755 build/scripts/entrypoint.sh /entrypoint.sh

#RUN mkdir -p ${EO_LOG}/docservice ${EO_LOG}/converter \
# ${EO_LOG}/adminpanel ${EO_LOG}/metrics

#RUN mkdir -p ${EO_ROOT}/documentserver-example/files

#RUN mkdir -p ${EO_ROOT}/server/Common/config && \
# echo '{}' > ${EO_ROOT}/server/Common/config/runtime.json

#RUN mkdir -p /var/lib/euro-office #&& \
# chown -R ds:ds /var/www/euro-office /var/lib/euro-office /var/log/euro-office

RUN /usr/bin/documentserver-flush-cache.sh -r false

ENTRYPOINT ["/entrypoint.sh"]
117 changes: 0 additions & 117 deletions build/.docker/docserver.bake.Dockerfile

This file was deleted.

86 changes: 46 additions & 40 deletions build/.docker/packages.bake.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,58 @@
# docker-bake.hcl files in the parent monorepos.
#
# REQUIRED CONTEXTS:
# - server: builds from server repo
# - core: builds from core repo
# - web-apps: builds from web-apps repo
# - sdkjs: builds from sdkjs repo
# - example: builds from example repo
# - bundle: bundled builds
# ==============================================================================

#### PACKAGE ####
# Extends finalubuntu (or a pre-built image via PACKAGE_BASE); installs packaging tools, then runs build-packages.sh
# to populate /build/package/out/ and invoke the upstream Makefile.

ARG PACKAGE_BASE

FROM ${PACKAGE_BASE} AS package
ARG PRODUCT_VERSION
ARG BUILD_NUMBER=0

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
devscripts dpkg-dev build-essential fakeroot debhelper \
rpm m4 curl ca-certificates gnupg symlinks && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
npm install -g @yao-pkg/pkg && \
rm -rf /var/lib/apt/lists/*

# Upstream packaging repo
COPY document-server-package/ /document-server-package/

# Original server source files required by the upstream Makefile's sed transforms
COPY server/Common/config/ /server-src/Common/config/
COPY server/schema/ /server-src/schema/
COPY server/license/ /server-src/license/
COPY server/LICENSE.txt /server-src/
COPY server/3rd-Party.txt /server-src/

COPY --chmod=755 build/scripts/build-packages.sh /build-packages.sh

ENV PRODUCT_VERSION=${PRODUCT_VERSION}
ENV BUILD_NUMBER=${BUILD_NUMBER}

RUN /build-packages.sh

FROM ubuntu:24.04 AS package

ARG PRODUCT_VERSION
ARG BUILD_NUMBER=0
ARG OUT_BASE="/build/package/out"
ARG BUNDLE_BASE="/build/bundle"
ARG OUT_DIR="${BUNDLE_BASE}/euro-office/documentserver"
ARG EXAMPLE_OUT="${BUNDLE_BASE}/euro-office/documentserver-example"

ENV PRODUCT_VERSION=${PRODUCT_VERSION}
ENV BUILD_NUMBER=${BUILD_NUMBER}
ENV OUT_BASE=${OUT_BASE}
ENV BUNDLE_BASE=${BUNDLE_BASE}
ENV OUT_DIR=${OUT_DIR}
ENV EXAMPLE_OUT=${EXAMPLE_OUT}

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
devscripts dpkg-dev build-essential fakeroot debhelper \
rpm m4 curl ca-certificates gnupg symlinks && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
npm install -g @yao-pkg/pkg && \
rm -rf /var/lib/apt/lists/*

#Build files
COPY --from=bundle /build/documentserver ${OUT_DIR}/
COPY --from=bundle /build/documentserver-example ${EXAMPLE_OUT}/

# Upstream packaging repo
COPY document-server-package/ /document-server-package/

RUN cd document-server-package && \
mkdir -p ${OUT_BASE} && \
ln -s ${BUNDLE_BASE} ${OUT_BASE}/linux_64 && \
ln -s ${BUNDLE_BASE} ${OUT_BASE}/linux_arm64 && \
make deb rpm \
BUILD_OUTPUT_DIR="${OUT_BASE}" \
PRODUCT_VERSION="${PRODUCT_VERSION}" \
BUILD_NUMBER="${BUILD_NUMBER}"

RUN mkdir -p /packages && \
find /document-server-package/deb -name "*.deb" -exec cp -v {} /packages/ \; && \
find /document-server-package/rpm/builddir -name "*.rpm" -exec cp -v {} /packages/ \;

#### PACKAGES OUTPUT ####
# Scratch stage so `docker build --target packages -o <dir>` extracts only
# the finished .deb and .rpm files.
FROM scratch AS packages
COPY --from=package /packages/ /
COPY --from=package /packages/ /
Loading
Loading