fix(docker): entrypoint chowns storage at container start
All checks were successful
Deploy Max Bot Test / deploy (push) Successful in 16s

Stale app.log owned by UID 82 (from previous image) blocked the UID-1000 php-fpm workers from writing. Entrypoint fixes ownership on every start, surviving migrations.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
pkirillw
2026-06-18 00:47:55 +03:00
parent bd5304ec5e
commit 2f56578d7a
2 changed files with 11 additions and 1 deletions

View File

@@ -17,6 +17,8 @@ RUN apk add --no-cache \
WORKDIR /var/www/html WORKDIR /var/www/html
COPY docker/php/entrypoint.sh /usr/local/bin/entrypoint.sh
# --- builder: composer install without dev deps, no scripts --- # --- builder: composer install without dev deps, no scripts ---
FROM base AS builder FROM base AS builder
COPY composer.json composer.lock ./ COPY composer.json composer.lock ./
@@ -32,6 +34,7 @@ COPY public ./public
COPY src ./src COPY src ./src
COPY storage ./storage COPY storage ./storage
RUN chown -R www-data:www-data /var/www/html/storage RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["php-fpm"] CMD ["php-fpm"]

7
docker/php/entrypoint.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
set -e
mkdir -p /var/www/html/storage/logs /var/www/html/storage/uploads
chown -R www-data:www-data /var/www/html/storage
exec docker-php-entrypoint "$@"