diff --git a/Dockerfile b/Dockerfile index c6d343942..2d02c00c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # Multistage build to reduce image size and increase security -FROM node:lts-slim AS build +FROM node:lts-alpine AS build # Create folder for CryptPad RUN mkdir /cryptpad @@ -20,19 +20,14 @@ RUN npm install --production \ && npm run install:components # Create actual CryptPad image -FROM node:lts-slim -ENV DEBIAN_FRONTEND=noninteractive +FROM node:lts-alpine # Create user and group for CryptPad so it does not run as root -RUN groupadd cryptpad -g 4001 -RUN useradd cryptpad -u 4001 -g 4001 -d /cryptpad +RUN addgroup -S cryptpad -g 4001 && adduser -S cryptpad -G cryptpad --uid 4001 -h /cryptpad # Install curl for healthcheck # Install git, rdfind and unzip for install-onlyoffice.sh -RUN apt-get update && apt-get install --no-install-recommends -y \ - curl ca-certificates git rdfind unzip && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* +RUN apk add --no-cache ca-certificates git rdfind unzip bash curl # Copy cryptpad with installed modules COPY --from=build --chown=cryptpad /cryptpad /cryptpad diff --git a/install-onlyoffice.sh b/install-onlyoffice.sh index 757be5437..4fd1264dc 100755 --- a/install-onlyoffice.sh +++ b/install-onlyoffice.sh @@ -289,7 +289,7 @@ install_version() { curl "https://github.com/cryptpad/onlyoffice-editor/releases/download/$VERSION/onlyoffice-editor.zip" --location --output "onlyoffice-editor.zip" echo "$HASH onlyoffice-editor.zip" >onlyoffice-editor.zip.sha512 - if ! sha512sum --check onlyoffice-editor.zip.sha512; then + if ! sha512sum -c onlyoffice-editor.zip.sha512; then echo "onlyoffice-editor.zip does not match expected checksum" exit 1 fi @@ -332,7 +332,7 @@ install_x2t() { ensure_command_available unzip curl "https://github.com/cryptpad/onlyoffice-x2t-wasm/releases/download/$VERSION/x2t.zip" --location --output x2t.zip echo "$HASH x2t.zip" >x2t.zip.sha512 - if ! sha512sum --check x2t.zip.sha512; then + if ! sha512sum -c x2t.zip.sha512; then echo "x2t.zip does not match expected checksum" exit 1 fi