fix docker
Some checks failed
Build, Push and Deploy / build-and-push (push) Failing after 1m56s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 8s
Build, Push and Deploy / deploy-staging (push) Has been skipped
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 0s

This commit is contained in:
eko
2026-03-29 15:33:07 +07:00
parent 957352e257
commit a234bc497e

View File

@@ -25,6 +25,9 @@ RUN apk add --no-cache \
exif \ exif \
pcntl pcntl
# Configure git to allow safe directory
RUN git config --global --add safe.directory /var/www/html
# Install Composer # Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
@@ -36,33 +39,25 @@ COPY --chown=www-data:www-data . .
# Remove any nested vendor directories # Remove any nested vendor directories
RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true
# Create all necessary directories with proper structure # Remove composer.lock to ensure fresh install
RUN mkdir -p storage/framework/cache \ RUN rm -f composer.lock
&& mkdir -p storage/framework/sessions \
&& mkdir -p storage/framework/views \ # Create all necessary directories
&& mkdir -p storage/framework/testing \ RUN mkdir -p storage/framework/{cache,sessions,views,testing} \
&& mkdir -p storage/logs \ && mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \ && mkdir -p bootstrap/cache \
&& mkdir -p storage/framework/cache/data \ && mkdir -p storage/framework/cache/data \
&& chmod -R 777 storage \ && chmod -R 777 storage \
&& chmod -R 777 bootstrap/cache && chmod -R 777 bootstrap/cache
# Create a temporary config to avoid cache path errors # Install PHP dependencies (full install, not just --no-scripts)
RUN if [ ! -f config/app.php ]; then \ RUN composer install --no-interaction --no-progress --optimize-autoloader
echo "<?php return ['providers' => []];" > config/app.php; \
# Verify critical files exist
RUN if [ ! -f vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php ]; then \
echo "ERROR: server.php missing!" && exit 1; \
fi fi
# Install PHP dependencies with --no-scripts to avoid cache path issues
RUN composer install --no-interaction --no-progress --optimize-autoloader --no-scripts
# Fix missing laravel/prompts
RUN if [ ! -f vendor/laravel/prompts/src/helpers.php ]; then \
composer require laravel/prompts --no-interaction --with-all-dependencies; \
fi
# Now run the scripts manually with proper environment
RUN composer run-script post-autoload-dump || true
# Copy package files for NPM # Copy package files for NPM
COPY package*.json ./ COPY package*.json ./
COPY vite.config.js ./ COPY vite.config.js ./
@@ -76,9 +71,8 @@ RUN npm run build || true
# Generate application key # Generate application key
RUN php artisan key:generate --no-interaction --force || true RUN php artisan key:generate --no-interaction --force || true
# Clear and cache config (but handle missing paths gracefully) # Cache configurations
RUN php artisan config:clear || true \ RUN php artisan config:cache || true
&& php artisan cache:clear || true
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh