RUN --mount=type=cache,target=/tmp/cache/files \ composer install \ --no-dev \ --ignore-platform-reqs \ --no-interaction \ --prefer-dist \ --no-plugins \ --no-scripts \ --no-autoloader COPY ./ /app/ RUN composer dump-autoload \ --no-dev \ --optimize FROM php:8.1-apache ENV WWWUSER www-data ENV APP_ROOT /app ENV APACHE_DOCUMENT_ROOT /app/public RUN apt-get update && apt-get install -y \ libicu-dev \ libzip-dev \ && rm -rf /var/lib/apt/lists/* RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \ docker-php-ext-install -j${NPROC} intl opcache pdo_mysql zip RUN pecl install redis apcu xdebug && \ docker-php-ext-enable redis RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' \ /etc/apache2/sites-available/*.conf RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' \ /etc/apache2/apache2.conf /etc/apache2/conf-available/* COPY --from=dep /app/ ${APP_ROOT} RUN chown -R ${WWWUSER}:${WWWUSER} ${APACHE_DOCUMENT_ROOT} \ ${APP_ROOT}/storage WORKDIR ${APP_ROOT} ↩ 本番環境向けに--no-devとか--optimizeとかい れたり、拡張とかApacheの設定とか諸々加えて いくとこんな感じになりそう (.dockerignoreも使おうね!)