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 traefik2.yml
Dockerfile* Dockerfile*
*.png *.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/ /onlyoffice-builds.git/
/www/common/onlyoffice/dist/ /www/common/onlyoffice/dist/
/install-onlyoffice-docker.key
/onlyoffice-dist/

View File

@ -21,6 +21,8 @@ RUN npm install --production \
# Create actual CryptPad image # Create actual CryptPad image
FROM node:lts-slim 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 # Create user and group for CryptPad so it does not run as root
RUN groupadd cryptpad -g 4001 RUN groupadd cryptpad -g 4001

View File

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

View File

@ -22,13 +22,19 @@ if [ ! -f "$CPAD_CONF" ]; then
eg: docker run -v /path/to/config.js:/cryptpad/config/config.js \n\ eg: docker run -v /path/to/config.js:/cryptpad/config/config.js \n\
#################################################################### \n" #################################################################### \n"
cp "$CPAD_HOME"/config/config.example.js "$CPAD_CONF" cp "$CPAD_HOME"/config/config.example.js "$CPAD_CONF"
sed -i -e "s@\(httpUnsafeOrigin:\).*[^,]@\1 '$CPAD_MAIN_DOMAIN'@" \ 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 fi
cd $CPAD_HOME 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 npm run build
exec "$@" exec "$@"