fix docker
This commit is contained in:
18
Dockerfile
18
Dockerfile
@@ -28,29 +28,25 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Copy composer files first (for dependency caching)
|
||||
# Copy ONLY composer files first (for better caching)
|
||||
COPY composer.json composer.lock* ./
|
||||
|
||||
# Install dependencies BEFORE copying application files
|
||||
RUN composer install --no-interaction --no-progress --optimize-autoloader
|
||||
# Install dependencies (including laravel/prompts)
|
||||
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader
|
||||
|
||||
# Copy the rest of the application files
|
||||
COPY --chown=www-data:www-data . .
|
||||
|
||||
# Create necessary directories
|
||||
# Create storage directories after copying files
|
||||
RUN mkdir -p storage/framework/{cache,sessions,views} \
|
||||
&& mkdir -p storage/logs \
|
||||
&& mkdir -p bootstrap/cache \
|
||||
&& chmod -R 775 storage \
|
||||
&& chmod -R 775 bootstrap/cache \
|
||||
&& chown -R www-data:www-data storage bootstrap
|
||||
&& chmod -R 777 storage \
|
||||
&& chmod -R 777 bootstrap/cache
|
||||
|
||||
# Generate application key
|
||||
# Generate key (after composer install and storage setup)
|
||||
RUN php artisan key:generate --no-interaction --force
|
||||
|
||||
# Clear and cache configurations (optional)
|
||||
RUN php artisan config:clear && php artisan cache:clear || true
|
||||
|
||||
# Copy entrypoint script
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
Reference in New Issue
Block a user