Remove OnlyOffice from docker image and install on startup

https://github.com/cryptpad/cryptpad/issues/1416
This commit is contained in:
Wolfgang Ginolas 2024-02-26 08:37:25 +01:00 committed by wginolas
parent 1bda1cf2fc
commit f5833a9430
5 changed files with 21 additions and 3 deletions

View file

@ -11,3 +11,10 @@ docker-compose.yml
traefik2.yml
Dockerfile*
*.png
/onlyoffice-builds.git/
/www/common/onlyoffice/dist/
blob
block
customize
data
datastore

2
.gitignore vendored
View file

@ -34,3 +34,5 @@ www/common/onlyoffice/v*
/onlyoffice-builds.git/
/www/common/onlyoffice/dist/
/install-onlyoffice-docker.key
/onlyoffice-dist/

View file

@ -21,6 +21,8 @@ RUN npm install --production \
# Create actual CryptPad image
FROM node:lts-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y git rdfind && rm -rf /var/lib/apt/lists/*
# Create user and group for CryptPad so it does not run as root
RUN groupadd cryptpad -g 4001

View file

@ -21,6 +21,7 @@ services:
- ./customize:/cryptpad/customize
- ./data/data:/cryptpad/data
- ./data/files:/cryptpad/datastore
- ./onlyoffice-dist:/cryptpad/www/common/onlyoffice/dist
ports:
- "3000:3000"

View file

@ -25,10 +25,16 @@ if [ ! -f "$CPAD_CONF" ]; then
cp "$CPAD_HOME"/config/config.example.js "$CPAD_CONF"
sed -i -e "s@\(httpUnsafeOrigin:\).*[^,]@\1 '$CPAD_MAIN_DOMAIN'@" \
-e "s@\(^ *\).*\(httpSafeOrigin:\).*[^,]@\1\2 '$CPAD_SANDBOX_DOMAIN'@" $CPAD_CONF
-e "s@\(^ *\).*\(httpSafeOrigin:\).*[^,]@\1\2 '$CPAD_SANDBOX_DOMAIN'@" "$CPAD_CONF"
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
npm run build
exec "$@"