From 12ae42442c5c71d429dbfba3c19e32b81b82201b Mon Sep 17 00:00:00 2001 From: eko Date: Mon, 16 Mar 2026 07:26:33 +0700 Subject: [PATCH] reorder dockerfile --- Dockerfile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index cc515bd..9461cd7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,21 +26,32 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer WORKDIR /var/www/html -# COPY ALL APPLICATION FILES FIRST (including artisan) +# Copy all application files COPY --chown=www-data:www-data . . # Create the missing Helper file RUN mkdir -p app/Helpers && \ echo " app/Helpers/Helper.php -# Create necessary directories +# Create ALL Laravel required directories with proper permissions RUN mkdir -p storage/framework/{cache,sessions,views} \ + && mkdir -p storage/framework/testing \ && mkdir -p storage/logs \ + && mkdir -p storage/app/public \ && mkdir -p bootstrap/cache \ - && chown -R www-data:www-data storage bootstrap/cache \ - && chmod -R 775 storage bootstrap/cache + && mkdir -p public/storage \ + && chown -R www-data:www-data storage bootstrap/cache public/storage \ + && chmod -R 775 storage bootstrap/cache \ + && chmod -R 777 storage/framework/sessions \ + && chmod -R 777 storage/logs -# NOW run composer install (artisan file exists at this point) +# Create .env file if it doesn't exist (required for Laravel) +RUN if [ ! -f .env ]; then cp .env.example .env 2>/dev/null || echo "APP_ENV=production\nAPP_DEBUG=false\nAPP_URL=https://kode.sadateknologi.site" > .env; fi + +# Generate key if .env exists (but don't fail if it doesn't) +RUN php artisan key:generate --no-interaction --force || true + +# Install dependencies RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader # Create startup script