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

This commit is contained in:
eko
2026-03-16 07:22:01 +07:00
parent 9627be1966
commit 36657b20ab

View File

@@ -1,16 +1,15 @@
FROM php:8.2-fpm-alpine FROM php:8.2-fpm-alpine
# Install system dependencies and PHP extensions # Install system dependencies
RUN apk add --no-cache \ RUN apk add --no-cache \
libzip-dev \ libzip-dev \
postgresql-dev \ postgresql-dev \
git \
curl \
# Add these for common Laravel extensions
libpng-dev \ libpng-dev \
libjpeg-turbo-dev \ libjpeg-turbo-dev \
freetype-dev \ freetype-dev \
oniguruma-dev \ oniguruma-dev \
git \
curl \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \ && docker-php-ext-install -j$(nproc) \
pdo_pgsql \ pdo_pgsql \
@@ -20,40 +19,29 @@ RUN apk add --no-cache \
bcmath \ bcmath \
gd \ gd \
exif \ exif \
pcntl \ pcntl
mysqli \
pdo_mysql \
&& docker-php-ext-enable \
pdo_pgsql \
pgsql \
opcache \
zip \
bcmath \
gd
# Install Composer # Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html WORKDIR /var/www/html
# Copy composer files first (for better caching) # COPY ALL APPLICATION FILES FIRST (including artisan)
COPY composer.json composer.lock ./
# Install dependencies with platform requirements ignored (temporary fix)
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader || \
composer install --no-dev --no-interaction --no-progress --optimize-autoloader --ignore-platform-req=ext-bcmath --ignore-platform-req=ext-gd --ignore-platform-req=ext-exif --ignore-platform-req=ext-pcntl
# Copy application files
COPY --chown=www-data:www-data . . COPY --chown=www-data:www-data . .
# Create the missing Helper file
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
# Create necessary directories # Create necessary directories
RUN mkdir -p storage/framework/{cache,sessions,views} \ RUN mkdir -p storage/framework/{cache,sessions,views} \
&& mkdir -p storage/logs \ && mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \ && mkdir -p bootstrap/cache \
&& chown -R www-data:www-data storage bootstrap/cache \ && chown -R www-data:www-data storage bootstrap/cache \
&& chmod -R 775 storage bootstrap/cache \ && chmod -R 775 storage bootstrap/cache
&& chmod 777 storage/framework/sessions \
&& chmod 777 storage/logs # NOW run composer install (artisan file exists at this point)
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader
# Create startup script # Create startup script
RUN echo '#!/bin/sh' > /start.sh && \ RUN echo '#!/bin/sh' > /start.sh && \