diff --git a/Dockerfile b/Dockerfile index 9461cd7..0feea3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,33 +26,36 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer WORKDIR /var/www/html -# Copy all application files +# Copy all application files (including your .env) COPY --chown=www-data:www-data . . # Create the missing Helper file RUN mkdir -p app/Helpers && \ echo " app/Helpers/Helper.php -# Create ALL Laravel required directories with proper permissions +# Create ALL Laravel storage 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 \ - && mkdir -p public/storage \ - && chown -R www-data:www-data storage bootstrap/cache public/storage \ + && chown -R www-data:www-data storage bootstrap/cache \ && chmod -R 775 storage bootstrap/cache \ && chmod -R 777 storage/framework/sessions \ && chmod -R 777 storage/logs -# 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 +# Verify directories exist (debug step) +RUN ls -la storage/framework/ && ls -la bootstrap/ -# Generate key if .env exists (but don't fail if it doesn't) +# Install dependencies with --no-scripts first +RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts + +# Run post-install scripts separately +RUN composer run-script post-autoload-dump || echo "Post-autoload dump skipped" + +# Generate key if not set in .env RUN php artisan key:generate --no-interaction --force || true -# Install dependencies -RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader +# Final permission check +RUN chmod -R 775 storage bootstrap/cache # Create startup script RUN echo '#!/bin/sh' > /start.sh && \