From bd5fc6e9a40a60bd70290564c5afa96eb2b80db1 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 22 Nov 2023 21:06:03 +0100 Subject: [PATCH 1/2] chore(tool): Remove unnecessary chown and user switch in Dockerfile Signed-off-by: jld3103 --- tool/Dockerfile.dev | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tool/Dockerfile.dev b/tool/Dockerfile.dev index 3819df84..cae67c59 100644 --- a/tool/Dockerfile.dev +++ b/tool/Dockerfile.dev @@ -2,8 +2,6 @@ ARG SERVER_VERSION=27.1.3-fpm-alpine@sha256:f1a13c7f60a9e9f5dcf14b7cb097083833ea FROM nextcloud:$SERVER_VERSION WORKDIR /usr/src/nextcloud -RUN chown -R www-data:www-data . -USER www-data RUN ./occ maintenance:install --admin-pass admin --admin-email admin@example.com RUN ./occ config:system:set allow_local_remote_servers --value=true @@ -35,7 +33,7 @@ ARG SPREED_VERSION=17.1.2 RUN install_app_version spreed https://github.com/nextcloud-releases/spreed/releases/download/v$SPREED_VERSION/spreed-v$SPREED_VERSION.tar.gz RUN ./occ talk:turn:add turn,turns staticauth.openrelay.metered.ca:443 udp,tcp --secret openrelayprojectsecret -COPY --chown=www-data:www-data dev/static /usr/src/nextcloud/static +COPY dev/static /usr/src/nextcloud/static ENV PHP_CLI_SERVER_WORKERS=10 CMD ["php", "-S", "0.0.0.0:80"] From ef551e19b01371bcc07447c7b441a3f1a247c0d6 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 22 Nov 2023 21:07:36 +0100 Subject: [PATCH 2/2] refactor(tool): Use multiple stages in Dockerfile Signed-off-by: jld3103 --- tool/Dockerfile.dev | 39 +++++++++++++++++++++++++++--------- tool/dev/install_app_version | 9 --------- 2 files changed, 29 insertions(+), 19 deletions(-) delete mode 100755 tool/dev/install_app_version diff --git a/tool/Dockerfile.dev b/tool/Dockerfile.dev index cae67c59..8995557a 100644 --- a/tool/Dockerfile.dev +++ b/tool/Dockerfile.dev @@ -1,5 +1,5 @@ ARG SERVER_VERSION=27.1.3-fpm-alpine@sha256:f1a13c7f60a9e9f5dcf14b7cb097083833eadf26858cb1f3f6b6251637b2e2dd -FROM nextcloud:$SERVER_VERSION +FROM nextcloud:$SERVER_VERSION as nextcloud WORKDIR /usr/src/nextcloud @@ -18,22 +18,41 @@ RUN (sh /entrypoint.sh php -S 0.0.0.0:80 &) && \ # Do not setup the demo user here for user in admin user1 user2; do curl -u "$user:$user" -H "ocs-apirequest: true" -s -o /dev/null http://localhost/ocs/v2.php/cloud/user; done -ADD dev/install_app_version /usr/local/bin/ +COPY dev/static /usr/src/nextcloud/static + +ENV PHP_CLI_SERVER_WORKERS=10 +CMD ["php", "-S", "0.0.0.0:80"] +FROM alpine:latest as apps +RUN apk add curl + +FROM apps as news ARG NEWS_VERSION=24.0.0 -RUN install_app_version news https://github.com/nextcloud/news/releases/download/$NEWS_VERSION/news.tar.gz +RUN curl -L "https://github.com/nextcloud/news/releases/download/$NEWS_VERSION/news.tar.gz" | tar -xz -C / +FROM apps as notes ARG NOTES_VERSION=4.8.1 -RUN install_app_version notes https://github.com/nextcloud-releases/notes/releases/download/v$NOTES_VERSION/notes.tar.gz +RUN curl -L "https://github.com/nextcloud-releases/notes/releases/download/v$NOTES_VERSION/notes.tar.gz" | tar -xz -C / +FROM apps as uppush ARG UPPUSH_VERSION=1.4.0 -RUN install_app_version uppush https://codeberg.org/NextPush/uppush/archive/$UPPUSH_VERSION.tar.gz +RUN curl -L "https://codeberg.org/NextPush/uppush/archive/$UPPUSH_VERSION.tar.gz" | tar -xz -C / +FROM apps as spreed ARG SPREED_VERSION=17.1.2 -RUN install_app_version spreed https://github.com/nextcloud-releases/spreed/releases/download/v$SPREED_VERSION/spreed-v$SPREED_VERSION.tar.gz -RUN ./occ talk:turn:add turn,turns staticauth.openrelay.metered.ca:443 udp,tcp --secret openrelayprojectsecret +RUN curl -L "https://github.com/nextcloud-releases/spreed/releases/download/v$SPREED_VERSION/spreed-v$SPREED_VERSION.tar.gz" | tar -xz -C / -COPY dev/static /usr/src/nextcloud/static +FROM nextcloud -ENV PHP_CLI_SERVER_WORKERS=10 -CMD ["php", "-S", "0.0.0.0:80"] +COPY --from=news /news /usr/src/nextcloud/apps/news +RUN ./occ app:enable news + +COPY --from=notes /notes /usr/src/nextcloud/apps/notes +RUN ./occ app:enable notes + +COPY --from=uppush /uppush /usr/src/nextcloud/apps/uppush +RUN ./occ app:enable uppush + +COPY --from=spreed /spreed /usr/src/nextcloud/apps/spreed +RUN ./occ app:enable spreed +RUN ./occ talk:turn:add turn,turns staticauth.openrelay.metered.ca:443 udp,tcp --secret openrelayprojectsecret diff --git a/tool/dev/install_app_version b/tool/dev/install_app_version deleted file mode 100755 index 622d23b2..00000000 --- a/tool/dev/install_app_version +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -euxo - -app="$1" -url="$2" - -cd /usr/src/nextcloud -curl -L "$url" | tar -xz -C "apps" -./occ app:enable "$app"