Files
kulakpos_web/Dockerfile
eko 36657b20ab
Some checks failed
Build, Push and Deploy / build-and-deploy (push) Failing after 2m6s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 8s
reorder dockerfile
2026-03-16 07:22:01 +07:00

59 lines
2.1 KiB
Docker

FROM php:8.2-fpm-alpine
# Install system dependencies
RUN apk add --no-cache \
libzip-dev \
postgresql-dev \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
oniguruma-dev \
git \
curl \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
pdo_pgsql \
pgsql \
opcache \
zip \
bcmath \
gd \
exif \
pcntl
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
# COPY ALL APPLICATION FILES FIRST (including artisan)
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
RUN mkdir -p storage/framework/{cache,sessions,views} \
&& mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \
&& chown -R www-data:www-data storage bootstrap/cache \
&& chmod -R 775 storage bootstrap/cache
# NOW run composer install (artisan file exists at this point)
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader
# Create startup script
RUN echo '#!/bin/sh' > /start.sh && \
echo 'if [ "$MODE" = "dev" ]; then' >> /start.sh && \
echo ' echo "Starting in DEV mode with PHP built-in server on port 8000..."' >> /start.sh && \
echo ' php artisan serve --host=0.0.0.0 --port=8000' >> /start.sh && \
echo 'else' >> /start.sh && \
echo ' echo "Starting in PROD mode with PHP-FPM on port 9000..."' >> /start.sh && \
echo ' php-fpm' >> /start.sh && \
echo 'fi' >> /start.sh && \
chmod +x /start.sh
EXPOSE 8000 9000
CMD ["/start.sh"]