Files
kulakpos_web/Dockerfile
eko f537c75c90
Some checks failed
Build, Push and Deploy / build-and-deploy (push) Failing after 2m6s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 8s
fix Dockerfile
2026-03-16 06:45:23 +07:00

71 lines
2.2 KiB
Docker

FROM php:8.2-fpm-alpine
# Install system dependencies and PHP extensions
RUN apk add --no-cache \
libzip-dev \
postgresql-dev \
git \
curl \
# Add these for common Laravel extensions
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
oniguruma-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
pdo_pgsql \
pgsql \
opcache \
zip \
bcmath \
gd \
exif \
pcntl \
mysqli \
pdo_mysql \
&& docker-php-ext-enable \
pdo_pgsql \
pgsql \
opcache \
zip \
bcmath \
gd
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
# Copy composer files first (for better caching)
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 . .
# 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 \
&& chmod 777 storage/framework/sessions \
&& chmod 777 storage/logs
# 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"]