Browse Source

refactor(tool): Use multiple stages in Dockerfile

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/1181/head
jld3103 1 year ago
parent
commit
ef551e19b0
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 39
      tool/Dockerfile.dev
  2. 9
      tool/dev/install_app_version

39
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

9
tool/dev/install_app_version

@ -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"
Loading…
Cancel
Save