From 6069e9455a18c6f367737185e1e3a746f1f2958d Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 18 Dec 2023 01:23:46 +0000 Subject: [PATCH] UPLOAD_MAX_FILESIZE with unit --- .docker/entrypoint.d/{config.json => config.json.tmpl} | 6 +++--- .docker/entrypoint.sh | 2 ++ .gitignore | 1 + Dockerfile | 5 ++--- 4 files changed, 8 insertions(+), 6 deletions(-) rename .docker/entrypoint.d/{config.json => config.json.tmpl} (92%) diff --git a/.docker/entrypoint.d/config.json b/.docker/entrypoint.d/config.json.tmpl similarity index 92% rename from .docker/entrypoint.d/config.json rename to .docker/entrypoint.d/config.json.tmpl index 3d7a9ff2..c306a591 100644 --- a/.docker/entrypoint.d/config.json +++ b/.docker/entrypoint.d/config.json.tmpl @@ -57,8 +57,8 @@ "options": { "admin": { "memory_limit": "256M", - "upload_max_filesize": "50M", - "post_max_size": "50M" + "upload_max_filesize": "$UPLOAD_MAX_FILESIZE", + "post_max_size": "$UPLOAD_MAX_FILESIZE" } }, "processes": { @@ -70,7 +70,7 @@ }, "settings": { "http": { - "max_body_size": 104857600 + "max_body_size": 1048576000 } } } diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh index 9649d66c..16ada386 100755 --- a/.docker/entrypoint.sh +++ b/.docker/entrypoint.sh @@ -12,6 +12,8 @@ chown shimmie:shimmie /app/data rm -rf /var/lib/unit/* +envsubst '$UPLOAD_MAX_FILESIZE' < /app/.docker/entrypoint.d/config.json.tmpl > /app/.docker/entrypoint.d/config.json + WAITLOOPS=5 SLEEPSEC=1 diff --git a/.gitignore b/.gitignore index 2edf4170..607cbefc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ thumbs *.sqlite *.cache trace.json +.docker/entrypoint.d/config.json #Composer composer.phar diff --git a/Dockerfile b/Dockerfile index fdbc9482..e7a0b74d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,7 @@ RUN echo 'deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages RUN apt update && apt install -y \ php${PHP_VERSION}-cli php${PHP_VERSION}-gd php${PHP_VERSION}-zip php${PHP_VERSION}-xml php${PHP_VERSION}-mbstring \ php${PHP_VERSION}-pgsql php${PHP_VERSION}-mysql php${PHP_VERSION}-sqlite3 \ - gosu curl imagemagick ffmpeg zip unzip git unit unit-php -RUN apt update && apt install -y procps net-tools + gosu curl imagemagick ffmpeg zip unzip git unit unit-php gettext procps net-tools # Composer has 100MB of dependencies, and we only need that during build and test FROM base AS composer @@ -49,7 +48,7 @@ EXPOSE 8000 FROM base AS run EXPOSE 8000 HEALTHCHECK --interval=1m --timeout=3s CMD curl --fail http://127.0.0.1:8000/ || exit 1 -ENV UID=1000 GID=1000 +ENV UID=1000 GID=1000 UPLOAD_MAX_FILESIZE=50M COPY --from=build /app /app ENTRYPOINT ["/app/.docker/entrypoint.sh"] CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]