Files
2026-10-26 05:52:27 +00:00

41 lines
1.8 KiB
Docker

FROM serversideup/php:8.3-fpm-nginx
ARG HTTP_PROXY
ARG HTTPS_PROXY
COPY --chown=www-data:www-data . /var/www/html/
ENV COMPOSER_HOME=/tmp/composer
USER www-data
RUN if [ -d /var/www/html/vendor ]; then \
echo "vendor/ found — installing offline" && \
HTTP_PROXY="" HTTPS_PROXY="" http_proxy="" https_proxy="" \
COMPOSER_DISABLE_NETWORK=1 \
composer install --no-dev --optimize-autoloader --no-interaction; \
else \
echo "vendor/ not found — installing from proxy" && \
composer config -g repos.packagist composer https://registry.parsaaghayi.ir/repository/composer-proxy/ && \
composer install --no-dev --optimize-autoloader --no-interaction; \
fi
# The admin panel now uploads images to the `public` disk and stores the URL
# Laravel hands back, which is served off disk by nginx. public/storage is
# gitignored, so it is absent from the build context and every uploaded image
# would 404 in production. The `|| ln` covers the case where artisan bails out
# because APP_KEY is not set yet in the build stage.
RUN php artisan storage:link \
|| ln -sfn /var/www/html/storage/app/public /var/www/html/public/storage
# StoreMediaRequest allows 4 MB, but PHP discards anything over 2 MB long
# before validation ever sees it, and Next's Server Action limit was raised to
# 8 MB. post_max_size has to exceed upload_max_filesize or the extra fields
# (and therefore $_POST) are dropped along with the file.
USER root
RUN INI_DIR="$(php --ini | sed -n 's/^Scan for additional .ini files in: //p' | tr -d '"')" \
&& test -n "$INI_DIR" \
&& mkdir -p "$INI_DIR" \
&& printf 'upload_max_filesize=8M\npost_max_size=10M\n' > "$INI_DIR/zz-uploads.ini" \
&& test "$(php -r 'echo ini_get("upload_max_filesize");')" = "8M" \
&& test "$(php -r 'echo ini_get("post_max_size");')" = "10M"
EXPOSE 8080