fix /plan
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 2m57s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s

This commit is contained in:
eko
2026-03-29 19:35:21 +07:00
parent 74e6666da5
commit d722295036
4 changed files with 98 additions and 37 deletions

View File

@@ -33,41 +33,39 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
# Copy ALL application files first
COPY --chown=www-data:www-data . .
# Copy ONLY composer files first
COPY composer.json composer.lock ./
# Remove any nested vendor directories
RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true
# Remove composer.lock to ensure fresh install
RUN rm -f composer.lock
# Create ALL storage directories BEFORE composer install
# Create storage and bootstrap directories needed for composer scripts
RUN mkdir -p storage/framework/cache \
&& mkdir -p storage/framework/sessions \
&& mkdir -p storage/framework/views \
&& mkdir -p storage/framework/testing \
&& mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \
&& mkdir -p storage/framework/cache/data \
&& chmod -R 777 storage \
&& chmod -R 777 bootstrap/cache
# Create a temporary config file to avoid cache path issues during composer
RUN if [ ! -f config/app.php ]; then \
echo "<?php return ['providers' => []];" > config/app.php; \
# Install PHP dependencies (this layer will be cached)
RUN composer install --no-interaction --no-progress --no-scripts
# Isolate the clean vendor directory
RUN mv vendor /vendor_clean
# Copy the rest of the application files (will ignore vendor because of .dockerignore)
COPY --chown=www-data:www-data . .
# Restore the clean vendor directory
RUN rm -rf vendor && mv /vendor_clean vendor
# Final build verification
RUN if [ ! -f vendor/laravel/prompts/src/helpers.php ]; then \
echo "ERROR: laravel/prompts/src/helpers.php missing!" && exit 1; \
fi
# Set environment variable for cache path
ENV VIEW_COMPILED_PATH=/var/www/html/storage/framework/views
# Install PHP dependencies
RUN composer install --no-interaction --no-progress --optimize-autoloader
# 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
# Final check and debug listing
RUN ls -l vendor/laravel/prompts/src/helpers.php \
&& du -sh vendor/laravel/prompts
# Copy package files for NPM
COPY package*.json ./
@@ -77,17 +75,12 @@ COPY vite.config.js ./
RUN npm install --legacy-peer-deps --no-audit
# Build Vite assets
RUN npm run build || true
# Generate application key
RUN php artisan key:generate --no-interaction --force || true
# Cache configurations
RUN php artisan config:cache || true
RUN npm run build
# Copy entrypoint script and ensure it's executable
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Let the entrypoint handle artisan commands at runtime
EXPOSE 8000 9000
ENTRYPOINT ["/entrypoint.sh"]