All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 9s
49 lines
1.4 KiB
Docker
49 lines
1.4 KiB
Docker
FROM php:8.2-fpm-alpine
|
|
|
|
# Install PostgreSQL extensions
|
|
RUN apk add --no-cache \
|
|
libzip-dev \
|
|
postgresql-dev \
|
|
&& docker-php-ext-install -j$(nproc) \
|
|
pdo_pgsql \
|
|
pgsql \
|
|
opcache \
|
|
zip \
|
|
&& docker-php-ext-enable \
|
|
pdo_pgsql \
|
|
pgsql \
|
|
opcache \
|
|
zip
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
# Copy application files
|
|
COPY --chown=www-data:www-data . .
|
|
|
|
# Create all necessary directories with proper permissions
|
|
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 to handle different modes
|
|
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
|
|
|
|
# Verify permissions (for debugging)
|
|
RUN ls -la storage/framework/
|
|
|
|
EXPOSE 8000 9000
|
|
|
|
# Use the startup script
|
|
CMD ["/start.sh"] |