fix(docker): create required Laravel runtime dirs before composer install

storage/framework/{cache,sessions,views}, storage/logs, and
bootstrap/cache are all gitignored with no tracked placeholder, so a
fresh checkout (as Coolify does) has none of them. composer install's
package:discover post-autoload script writes to bootstrap/cache and
failed with "directory must be present and writable" since it simply
didn't exist yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Tim Stollberg 2026-07-18 15:34:36 +07:00
parent a56c22953c
commit 3da50c8967

View file

@ -17,7 +17,8 @@ WORKDIR /var/www/html
COPY backend/ /var/www/html COPY backend/ /var/www/html
COPY docker/php/entrypoint.prod.sh /entrypoint.sh COPY docker/php/entrypoint.prod.sh /entrypoint.sh
RUN composer install --no-dev --optimize-autoloader --no-interaction \ RUN mkdir -p storage/framework/cache storage/framework/sessions storage/framework/views storage/logs bootstrap/cache \
&& composer install --no-dev --optimize-autoloader --no-interaction \
&& chmod +x /entrypoint.sh \ && chmod +x /entrypoint.sh \
&& chown -R www-data:www-data storage bootstrap/cache && chown -R www-data:www-data storage bootstrap/cache