From e509d0eb288d3336a97d10884dd04fe65409ef4c Mon Sep 17 00:00:00 2001
From: Glenn <glenux@glenux.net>
Date: Sun, 5 May 2024 19:26:20 +0200
Subject: [PATCH] fix: workdir may not be available at startup

---
 Dockerfile | 18 +++++++++++-------
 app.json   |  2 +-
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 8b7ca58..7370409 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -22,7 +22,8 @@ FROM nextcloud:29.0.0-apache
 # This is a stupid comment for a demo (remove later)
 
 RUN apt-get update \
- && apt-get install -y clamdscan nano ghostscript \
+ && apt-get install -y --no-install-recommends \
+        clamdscan nano ghostscript \
  && apt-get clean
 
 #
@@ -52,21 +53,24 @@ RUN apt-get update \
 ## GMP Support (for bookmark extension)
 ##
 RUN apt-get update \
- && apt-get install -y libgmp3-dev \
+ && apt-get install -y --no-install-recommends \
+        libgmp3-dev \
  && docker-php-ext-install gmp
 
 ##
 ## BZ2 Support (for nextcloud)
 ##
 RUN apt-get update \
- && apt-get install -y libbz2-dev \
+ && apt-get install -y --no-install-recommends \
+        libbz2-dev \
  && docker-php-ext-install bz2
 
 ##
 ## SVG and LibreSign support
 ##
 RUN apt-get update \
-  && apt-get install -y libmagickcore-6.q16-6-extra \
+  && apt-get install -y --no-install-recommends \
+         libmagickcore-6.q16-6-extra \
   && rm -rf /var/lib/apt/lists/*
 
 RUN sed -i'' 's|.*<policy domain="coder".*"PDF".*|<policy domain="coder" rights="read \| write" pattern="PDF" />|g' \
@@ -90,14 +94,14 @@ RUN echo '[opcache]' > /usr/local/etc/php/conf.d/opcache.ini \
 RUN echo '*/5 * * * * php -d memory_limit=1024M -f /var/www/html/cron.php' \
     > /var/spool/cron/crontabs/www-data
 
-RUN apt-get update && apt-get install -y \
+RUN apt-get update && apt-get install -y --no-install-recommends \
     supervisor \
   && rm -rf /var/lib/apt/lists/* \
   && mkdir /var/log/supervisord /var/run/supervisord
 COPY supervisord.conf /etc/supervisord.conf
 
-COPY ./app.json /app.json
-COPY ./postdeploy.sh /dokku/postdeploy.sh
+COPY ./app.json /app/app.json
+COPY ./postdeploy.sh /app/postdeploy.sh
 
 ENV NEXTCLOUD_UPDATE=1
 
diff --git a/app.json b/app.json
index 072ba6f..9c60d3c 100644
--- a/app.json
+++ b/app.json
@@ -1,7 +1,7 @@
 {
   "scripts": {
     "dokku": {
-      "postdeploy": "su -l -s /bin/sh www-data -c /dokku/postdeploy.sh"
+      "postdeploy": "su -l -s /bin/sh www-data -c /app/postdeploy.sh"
     }
   }
 }