Docker does not install OnlyOffice by default

https://github.com/cryptpad/cryptpad/issues/1416
This commit is contained in:
Wolfgang Ginolas 2024-02-26 15:20:17 +01:00 committed by wginolas
parent f5833a9430
commit 15ec7d74fd
3 changed files with 38 additions and 25 deletions

View file

@ -15,6 +15,10 @@ services:
- CPAD_SANDBOX_DOMAIN=https://your-sandbox-domain.com
- CPAD_CONF=/cryptpad/config/config.js
# Uncomment the next line, when you want to use OnlyOffice on
# your installation. TODO add link to license
# - CPAD_INSTALL_ONLYOFFICE=yes
volumes:
- ./data/blob:/cryptpad/blob
- ./data/block:/cryptpad/block

View file

@ -29,12 +29,16 @@ if [ ! -f "$CPAD_CONF" ]; then
fi
cd $CPAD_HOME
eval "$(ssh-agent -s)" # TODO remove this when repo is public
ssh-add install-onlyoffice-docker.key
mkdir -p ~/.ssh
chmod 0700 ~/.ssh
ssh-keyscan github.com > ~/.ssh/known_hosts
./install-onlyoffice.sh -c -l # TODO run only when OnlyOffice is enabled
if [ "$CPAD_INSTALL_ONLYOFFICE" == "yes" ]; then
eval "$(ssh-agent -s)" # TODO remove this when repo is public
ssh-add install-onlyoffice-docker.key
mkdir -p ~/.ssh
chmod 0700 ~/.ssh
ssh-keyscan github.com > ~/.ssh/known_hosts
./install-onlyoffice.sh -c -l
fi
npm run build
exec "$@"

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -euxo pipefail
set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
BUILDS_DIR=$SCRIPT_DIR/onlyoffice-builds.git
@ -90,12 +90,14 @@ ensure_commit_exists () {
LAST_DIR=$(pwd)
cd "$BUILDS_DIR"
if ! git cat-file -e "$1"; then
echo Fetch new OnlyOffice version...
git fetch
fi
cd "$LAST_DIR"
return
fi
echo Downloading OnlyOffice...
git clone --bare git@github.com:cryptpad/onlyoffice-builds.git "$BUILDS_DIR" # TODO use https here, when repo is public
}
@ -106,28 +108,31 @@ install_version () {
local LAST_DIR
LAST_DIR=$(pwd)
if [ ! -e "$FULL_DIR"/.commit ]; then
if [ "$(cat "$FULL_DIR"/.commit)" != "$COMMIT" ]; then
ensure_commit_exists "$COMMIT"
if [ ! -e "$FULL_DIR"/.commit ] || [ "$(cat "$FULL_DIR"/.commit)" != "$COMMIT" ]; then
ensure_commit_exists "$COMMIT"
if [ ! -e "$FULL_DIR"/.git ]; then
rm -rf "$FULL_DIR"
fi
if [ -d "$FULL_DIR" ]; then
cd "$FULL_DIR"
git checkout "$COMMIT"
else
cd "$BUILDS_DIR"
git worktree add "$FULL_DIR" "$COMMIT"
fi
cd "$LAST_DIR"
echo "$COMMIT" > "$FULL_DIR"/.commit
if [ ! -e "$FULL_DIR"/.git ]; then
rm -rf "$FULL_DIR"
fi
if [ -d "$FULL_DIR" ]; then
cd "$FULL_DIR"
git checkout "$COMMIT"
else
cd "$BUILDS_DIR"
git worktree add "$FULL_DIR" "$COMMIT"
fi
cd "$LAST_DIR"
echo "$COMMIT" > "$FULL_DIR"/.commit
echo "$DIR" updated
else
echo "$DIR" was up to date
fi
if [ ${CLEAR+x} ]; then
rm -f "$FULL_DIR"/.git
fi