From c01d95a61bc920193b97cb980a3b756b8ae1dbd4 Mon Sep 17 00:00:00 2001 From: arifal Date: Fri, 19 Sep 2025 21:59:22 +0700 Subject: [PATCH] add build and storage link --- Dockerfile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index fb7cd36..6266e6c 100755 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,8 @@ RUN apt-get update && apt-get install -y \ libvpx-dev \ supervisor \ nginx \ + nodejs \ + npm \ && rm -rf /var/lib/apt/lists/* # Install PHP extensions @@ -44,14 +46,21 @@ RUN pecl install redis \ # Install Composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer -# Copy only composer files first for caching -COPY composer.json composer.lock ./ +# Copy only composer and package files first for caching +COPY composer.json composer.lock package.json package-lock.json ./ + +# Install PHP dependencies (cached if lock file unchanged) +RUN composer install --optimize-autoloader --no-dev --no-interaction + +# Install Node dependencies (cached if lock file unchanged) +RUN npm ci --only=production # Now copy the full Laravel application code COPY . . -# Install PHP dependencies (cached if lock file unchanged) -RUN composer install --optimize-autoloader --no-dev --no-interaction +# Build assets and create storage link +RUN npm run production && \ + php artisan storage:link # Set proper permissions (for production only do this once) RUN mkdir -p storage/logs \