fix docker
Some checks failed
Build, Push and Deploy / build-and-push (push) Failing after 1m51s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 9s
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 1s

This commit is contained in:
eko
2026-03-29 14:45:23 +07:00
parent b0a929684a
commit 46b1a4f74d

View File

@@ -30,27 +30,20 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
# Copy composer files first
COPY composer.json composer.lock ./
# Copy ALL application files first (including artisan)
COPY --chown=www-data:www-data . .
# Create missing Helper.php file before composer install
RUN mkdir -p app/Helpers && \
cat > app/Helpers/Helper.php << 'EOF'
<?php
# Remove any nested vendor directories to avoid conflicts
RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true
namespace App\Helpers;
# Create necessary directories
RUN mkdir -p storage/framework/{cache,sessions,views} \
&& mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \
&& chmod -R 777 storage \
&& chmod -R 777 bootstrap/cache
class Helper
{
// Add your helper functions here
public static function example()
{
return "Helper loaded";
}
}
EOF
# Install PHP dependencies
# Install PHP dependencies (artisan file now exists)
RUN composer install --no-interaction --no-progress --optimize-autoloader
# Copy package files for NPM
@@ -60,19 +53,6 @@ COPY vite.config.js ./
# Install NPM dependencies
RUN npm install --legacy-peer-deps --no-audit
# Copy application files (this will overwrite the placeholder Helper.php if exists)
COPY --chown=www-data:www-data . .
# Remove any nested vendor directories to avoid conflicts
RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true
# Create all necessary directories
RUN mkdir -p storage/framework/{cache,sessions,views} \
&& mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \
&& chmod -R 777 storage \
&& chmod -R 777 bootstrap/cache
# Build Vite assets
RUN npm run build