mandant-crm/docker/php/Dockerfile.prod
Tim Stollberg 3da50c8967 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>
2026-07-18 15:34:36 +07:00

27 lines
699 B
Docker

FROM php:8.2-cli-alpine
RUN apk add --no-cache \
curl \
libpng-dev \
libxml2-dev \
zip \
unzip \
git \
sqlite-dev \
&& docker-php-ext-install pdo pdo_mysql pdo_sqlite gd
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
COPY backend/ /var/www/html
COPY docker/php/entrypoint.prod.sh /entrypoint.sh
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 \
&& chown -R www-data:www-data storage bootstrap/cache
EXPOSE 8000
ENTRYPOINT ["/entrypoint.sh"]