reorder dockerfile
Some checks failed
Build, Push and Deploy / build-and-deploy (push) Failing after 1m44s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s

This commit is contained in:
eko
2026-03-16 07:26:33 +07:00
parent 36657b20ab
commit 12ae42442c

View File

@@ -26,21 +26,32 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html WORKDIR /var/www/html
# COPY ALL APPLICATION FILES FIRST (including artisan) # Copy all application files
COPY --chown=www-data:www-data . . COPY --chown=www-data:www-data . .
# Create the missing Helper file # Create the missing Helper file
RUN mkdir -p app/Helpers && \ RUN mkdir -p app/Helpers && \
echo "<?php\n\nnamespace App\Helpers;\n\nclass Helper\n{\n public static function formatCurrency(\$amount, \$currency = 'INR')\n {\n return \$currency . ' ' . number_format(\$amount, 2);\n }\n\n public static function generateRandomString(\$length = 10)\n {\n return substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, \$length);\n }\n}\n" > app/Helpers/Helper.php echo "<?php\n\nnamespace App\Helpers;\n\nclass Helper\n{\n public static function formatCurrency(\$amount, \$currency = 'INR')\n {\n return \$currency . ' ' . number_format(\$amount, 2);\n }\n\n public static function generateRandomString(\$length = 10)\n {\n return substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, \$length);\n }\n}\n" > app/Helpers/Helper.php
# Create necessary directories # Create ALL Laravel required directories with proper permissions
RUN mkdir -p storage/framework/{cache,sessions,views} \ RUN mkdir -p storage/framework/{cache,sessions,views} \
&& mkdir -p storage/framework/testing \
&& mkdir -p storage/logs \ && mkdir -p storage/logs \
&& mkdir -p storage/app/public \
&& mkdir -p bootstrap/cache \ && mkdir -p bootstrap/cache \
&& chown -R www-data:www-data storage bootstrap/cache \ && mkdir -p public/storage \
&& chmod -R 775 storage bootstrap/cache && chown -R www-data:www-data storage bootstrap/cache public/storage \
&& chmod -R 775 storage bootstrap/cache \
&& chmod -R 777 storage/framework/sessions \
&& chmod -R 777 storage/logs
# NOW run composer install (artisan file exists at this point) # 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
# Generate key if .env exists (but don't fail if it doesn't)
RUN php artisan key:generate --no-interaction --force || true
# Install dependencies
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader
# Create startup script # Create startup script