Skip to content

Commit 26b3f10

Browse files
committed
Docker GH action: rework for the online monorepo
The separate core repo on gerrit.collaboraoffice.com is gone; what used to be core is now the engine/ subdir of the online monorepo. Clone online from Gerrit, drop the separate core clone, and treat online/engine/ as the engine source and asset root. Default COLLABORA_ONLINE_REPO to the Gerrit URL (also set explicitly in the Dockerfile), remove the obsolete CORE_BRANCH variable, extract prebuilt engine assets into online/engine/, and point --with-lokit-path at online/engine/include. Also rename CORE_ASSETS to ENGINE_ASSETS, CORE_BUILD_TARGET to ENGINE_BUILD_TARGET, and the install path /opt/lokit to /opt/collaboraoffice across the script, Dockerfile, and README. This unblocks the nightly docker build, which has been picking up an out-of-date GitHub mirror of main. Change-Id: I101955201de40eb416595418eadb0f1012ed068e Signed-off-by: Andras Timar <[email protected]>
1 parent 6ee65fe commit 26b3f10

3 files changed

Lines changed: 37 additions & 57 deletions

File tree

docker/from-source-gh-action/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
FROM ubuntu:24.04 AS builder
22

3-
ENV CORE_ASSETS=https://github.com/CollaboraOnline/online/releases/download/for-code-assets/engine-main-assets.tar.gz
3+
ENV ENGINE_ASSETS=https://github.com/CollaboraOnline/online/releases/download/for-code-assets/engine-main-assets.tar.gz
44
ENV BUILDDIR=/build
5+
ENV COLLABORA_ONLINE_REPO=https://gerrit.collaboraoffice.com/online
56
ENV COLLABORA_ONLINE_BRANCH=main
67
ENV ONLINE_EXTRA_BUILD_OPTIONS=--enable-experimental
78

@@ -19,7 +20,7 @@ RUN --mount=type=cache,target=/var/cache/apt apt-get update && \
1920
libcap2-bin python3-lxml libpng-dev libcppunit-dev \
2021
pkg-config fontconfig snapd chromium-browser \
2122
rsync curl \
22-
# core build dependencies, only those that are needed for LOKit
23+
# engine build dependencies
2324
git build-essential zip ccache autoconf gperf nasm xsltproc flex bison
2425

2526
RUN curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh && bash nodesource_setup.sh && apt install -y nodejs
@@ -45,7 +46,7 @@ FROM ubuntu:24.04
4546
ENV LC_CTYPE=C.UTF-8
4647

4748
# refresh repos otherwise installations later may fail
48-
# install LibreOffice run-time dependencies
49+
# install engine run-time dependencies
4950
# install adduser, findutils, openssl and cpio that we need later
5051
# install tzdata to accept the TZ environment variable
5152
# install an editor
@@ -60,7 +61,7 @@ RUN apt-get update \
6061
libnss-wrapper \
6162
&& rm -rf /var/lib/apt/lists/*
6263

63-
# copy freshly built LOKit and Collabora Online
64+
# copy freshly built engine and Collabora Online
6465
COPY --from=builder /build/instdir /
6566

6667
# copy the shell script which can start Collabora Online (coolwsd)
@@ -77,8 +78,8 @@ RUN setcap cap_fowner,cap_chown,cap_sys_chroot=ep /usr/bin/coolforkit-caps && \
7778
chown cool: /opt/cool && \
7879
chown cool: /opt/cool/child-roots && \
7980
chown cool: /opt/cool/cache && \
80-
fc-cache /opt/lokit/share/fonts/truetype && \
81-
coolwsd-systemplate-setup /opt/cool/systemplate /opt/lokit >/dev/null 2>&1 && \
81+
fc-cache /opt/collaboraoffice/share/fonts/truetype && \
82+
coolwsd-systemplate-setup /opt/cool/systemplate /opt/collaboraoffice >/dev/null 2>&1 && \
8283
touch /var/log/coolwsd.log && \
8384
chown cool:cool /var/log/coolwsd.log && \
8485
chown -R cool:cool /etc/coolwsd && \

docker/from-source-gh-action/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
This directory contains relevant files for building a docker image from source code using GitHub Actions. The Dockerfile is used to build the image is different from the regular from-source approach as it isolates the build within docker so that the build environment is not dependent on the host environment.
22

3-
Right now core is not built from source but uses the prebuilt binaries.
3+
Right now the engine is not built from source but uses the prebuilt binaries.
44

55
## Build locally
66

docker/from-source-gh-action/build.sh

Lines changed: 29 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,30 @@
44
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
55

66
# -- Available env vars --
7-
# * CORE_ASSETS - which prebuilt assets to build in core
8-
# * CORE_BRANCH - which branch to build in core
9-
# * COLLABORA_ONLINE_REPO - which git repo to clone online from
10-
# * COLLABORA_ONLINE_BRANCH - which branch to build in online
11-
# * CORE_BUILD_TARGET - which make target to run (in core repo)
7+
# * ENGINE_ASSETS - URL of prebuilt engine assets tarball (skips building engine)
8+
# * COLLABORA_ONLINE_REPO - which git repo to clone the online monorepo from
9+
# * COLLABORA_ONLINE_BRANCH - which branch to build
10+
# * ENGINE_BUILD_TARGET - which make target to run for the engine (when building from source)
1211
# * ONLINE_EXTRA_BUILD_OPTIONS - extra build options for online
1312

14-
if [ -z "$CORE_ASSETS" ]; then
15-
if [ -z "$CORE_BRANCH" ]; then
16-
CORE_BRANCH="main"
17-
fi;
18-
echo "Building core branch '$CORE_BRANCH'"
19-
else
20-
echo "Building from core assets $CORE_ASSETS"
21-
fi;
22-
2313
if [ -z "$COLLABORA_ONLINE_REPO" ]; then
24-
COLLABORA_ONLINE_REPO="https://github.com/CollaboraOnline/online.git"
14+
COLLABORA_ONLINE_REPO="https://gerrit.collaboraoffice.com/online"
2515
fi;
2616
if [ -z "$COLLABORA_ONLINE_BRANCH" ]; then
2717
COLLABORA_ONLINE_BRANCH="main"
2818
fi;
29-
echo "Building online branch '$COLLABORA_ONLINE_BRANCH' from '$COLLABORA_ONLINE_REPO'"
19+
echo "Building branch '$COLLABORA_ONLINE_BRANCH' from '$COLLABORA_ONLINE_REPO'"
3020

31-
if [ -z "$CORE_BUILD_TARGET" ]; then
32-
CORE_BUILD_TARGET=""
21+
if [ -z "$ENGINE_ASSETS" ]; then
22+
echo "Building engine from source"
23+
else
24+
echo "Using prebuilt engine assets from $ENGINE_ASSETS"
3325
fi;
34-
echo "COKit (core) build target: '$CORE_BUILD_TARGET'"
26+
27+
if [ -z "$ENGINE_BUILD_TARGET" ]; then
28+
ENGINE_BUILD_TARGET=""
29+
fi;
30+
echo "Engine build target: '$ENGINE_BUILD_TARGET'"
3531

3632
SRCDIR=$(realpath `dirname $0`)
3733
INSTDIR="$SRCDIR/instdir"
@@ -58,49 +54,32 @@ fi
5854

5955
##### cloning & updating #####
6056

61-
# core repo
62-
# only if CORE_ASSETS is not set
63-
if [ -z "$CORE_ASSETS" ]; then
64-
if test ! -d core ; then
65-
git clone https://gerrit.collaboraoffice.com/core || exit 1
66-
fi
67-
68-
( cd core && git fetch --all && git checkout $CORE_BRANCH && ./g pull -r ) || exit 1
69-
else
70-
mkdir -p core
71-
( cd core/ && wget "$CORE_ASSETS" -O core-assets.tar.xz && tar -xzf core-assets.tar.xz && rm core-assets.tar.xz) || exit 1
72-
fi
73-
74-
75-
# Clone online repo
57+
# Clone the online monorepo (engine/ contains the rendering engine)
7658
if test ! -d online ; then
7759
git clone --depth=1 --branch $COLLABORA_ONLINE_BRANCH "$COLLABORA_ONLINE_REPO" online || exit 1
7860
fi
7961

8062
( cd online && git fetch --all && git checkout -f $COLLABORA_ONLINE_BRANCH && git clean -f -d && git pull -r ) || exit 1
8163

82-
##### COKit (core) #####
83-
84-
# only if core assets are not set
85-
if [ -z "$CORE_ASSETS" ]; then
86-
# build
87-
( cd core && ./autogen.sh --with-distro=CPLinux-LOKit --disable-epm --without-package-format --disable-symbols ) || exit 1
88-
( cd core && make $CORE_BUILD_TARGET ) || exit 1
64+
##### engine #####
8965

90-
# copy stuff
91-
mkdir -p "$INSTDIR"/opt/
92-
cp -a core/instdir "$INSTDIR"/opt/lokit
66+
if [ -z "$ENGINE_ASSETS" ]; then
67+
# build engine from source
68+
( cd online/engine && ./autogen.sh --with-distro=CPLinux-LOKit --disable-epm --without-package-format --disable-symbols ) || exit 1
69+
( cd online/engine && make $ENGINE_BUILD_TARGET ) || exit 1
9370
else
94-
echo "Using prebuilt core assets"
95-
mkdir -p "$INSTDIR"/opt/
96-
cp -a core/instdir "$INSTDIR"/opt/lokit
71+
# drop in prebuilt engine assets
72+
( cd online/engine && wget "$ENGINE_ASSETS" -O engine-assets.tar.xz && tar -xzf engine-assets.tar.xz && rm engine-assets.tar.xz ) || exit 1
9773
fi
9874

75+
mkdir -p "$INSTDIR"/opt/
76+
cp -a online/engine/instdir "$INSTDIR"/opt/collaboraoffice
77+
9978
##### coolwsd & cool #####
10079

10180
# build
10281
( cd online && ./autogen.sh ) || exit 1
103-
( cd online && ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-silent-rules --disable-tests --with-lokit-path="$BUILDDIR"/core/include --with-lo-path=/opt/lokit --with-poco-includes=$BUILDDIR/poco/include --with-poco-libs=$BUILDDIR/poco/lib $ONLINE_EXTRA_BUILD_OPTIONS) || exit 1
82+
( cd online && ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-silent-rules --disable-tests --with-lokit-path="$BUILDDIR"/online/engine/include --with-lo-path=/opt/collaboraoffice --with-poco-includes=$BUILDDIR/poco/include --with-poco-libs=$BUILDDIR/poco/lib $ONLINE_EXTRA_BUILD_OPTIONS) || exit 1
10483
( cd online && make -j $(nproc)) || exit 1
10584

10685
# copy stuff
@@ -110,7 +89,7 @@ fi
11089
if test -d online-branding ; then
11190
if ! which sass &> /dev/null; then npm install -g sass; fi
11291
cd online-branding
113-
./brand.sh $INSTDIR/opt/lokit $INSTDIR/usr/share/coolwsd/browser/dist CODE # CODE
114-
./brand.sh $INSTDIR/opt/lokit $INSTDIR/usr/share/coolwsd/browser/dist NC-theme-community # Nextcloud Office
92+
./brand.sh $INSTDIR/opt/collaboraoffice $INSTDIR/usr/share/coolwsd/browser/dist CODE # CODE
93+
./brand.sh $INSTDIR/opt/collaboraoffice $INSTDIR/usr/share/coolwsd/browser/dist NC-theme-community # Nextcloud Office
11594
cd ..
11695
fi

0 commit comments

Comments
 (0)