Files
kulakpos_web/Dockerfile
eko 3f5cdcc558
Some checks failed
Build, Push and Deploy / build-and-deploy (push) Failing after 1m13s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s
fix pipeline
2026-03-16 06:41:29 +07:00

56 lines
1.6 KiB
Docker

FROM php:8.2-fpm-alpine
# Install dependencies
RUN apk add --no-cache \
libzip-dev \
postgresql-dev \
git \
curl \
&& docker-php-ext-install -j$(nproc) \
pdo_pgsql \
pgsql \
opcache \
zip \
&& docker-php-ext-enable \
pdo_pgsql \
pgsql \
opcache \
zip
# 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
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader
# 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"]