Dockerfile ошибка при сборке проекта на Laravel
При сборке проекта, выдает ошибку
#17 2.144 0/98 [>---------------------------] 0%
#17 2.285 20/98 [=====>----------------------] 20%
#17 2.534 30/98 [========>-------------------] 30%
#17 2.753 47/98 [=============>--------------] 47%
#17 2.863 50/98 [==============>-------------] 51%
#17 3.042 59/98 [================>-----------] 60%
#17 3.358 70/98 [====================>-------] 71%
#17 4.256 80/98 [======================>-----] 81%
#17 4.729 91/98 [==========================>-] 92%
#17 5.712 98/98 [============================] 100%
#17 5.920 Generating optimized autoload files
#17 8.416 > Illuminate\Foundation\ComposerScripts::postAutoloadDump
#17 8.438 > @php artisan package:discover --ansi
#17 8.455 Could not open input file: artisan
#17 8.461 Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
#17 ...
#12 [node 1/15] FROM docker.io/library/node:latest@sha256:914458d8617650599ec2c05f6754403a1ce08cb471b0b1de1de439c539f8d45f
#12 CANCELED
#17 [composer_install 4/4] RUN composer install --optimize-autoloader --no-dev
#17 ERROR: process "/bin/sh -c composer install --optimize-autoloader --no-dev" did not complete successfully: exit code: 1
------
> [composer_install 4/4] RUN composer install --optimize-autoloader --no-dev:
3.042 59/98 [================>-----------] 60%
3.358 70/98 [====================>-------] 71%
4.256 80/98 [======================>-----] 81%
4.729 91/98 [==========================>-] 92%
5.712 98/98 [============================] 100%
5.920 Generating optimized autoload files
8.416 > Illuminate\Foundation\ComposerScripts::postAutoloadDump
8.438 > @php artisan package:discover --ansi
8.455 Could not open input file: artisan
8.461 Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
------
Dockerfile:4
--------------------
2 | WORKDIR /www
3 | COPY composer.* ./
4 | >>> RUN composer install --optimize-autoloader --no-dev
5 |
6 | FROM php:8.3-fpm as php_fpm
--------------------
ERROR: failed to solve: process "/bin/sh -c composer install --optimize-autoloader --no-dev" did not complete successfully: exit code: 1
Error: Process completed with exit code 1.
мой Dockerfile
FROM composer as composer_install
WORKDIR /www
COPY composer.* ./
RUN composer install --optimize-autoloader --no-dev
FROM php:8.3-fpm as php_fpm
WORKDIR /www
COPY --from=composer_install /www /www
RUN apk --no-cache update && apk add --no-cache \
icu-libs \
bash \
autoconf g++ make \
postgresql-dev \
ffmpeg \
git \
curl \
libmemcached-dev \
libz-dev \
libpq-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libssl-dev \
libwebp-dev \
libxpm-dev \
libmcrypt-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
icu-dev \
autoconf \
openssl \
make \
g++ \
&& docker-php-ext-install pdo_pgsql mbstring exif pcntl bcmath gd fileinfo xmlwriter tokenizer sodium session gmp pdo xml dom \
&& docker-php-source delete \
&& apk del .build-deps
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Этап 2: Установка Node.js
FROM node:latest as node
WORKDIR /www
COPY --from=php_fpm /www /www
RUN npm ci
# Очистка кэша в Laravel
RUN ./vendor/bin/sail artisan config:clear
RUN ./vendor/bin/sail artisan route:clear
RUN ./vendor/bin/sail artisan view:clear
RUN ./vendor/bin/sail artisan storage:link
RUN ./vendor/bin/sail artisan migarte
# Cборка фронтенда
RUN npm run build
# Кэширование Laravel
RUN ./vendor/bin/sail artisan optimize
RUN ./vendor/bin/sail artisan config:cache
RUN ./vendor/bin/sail artisan view:cache
RUN ./vendor/bin/sail artisan route:cache
#RUN php artisan key:generate
RUN chmod -R 777 /www/storage
EXPOSE 9000