fix dockerfile
All checks were successful
Build, Push and Deploy / build-and-deploy (push) Successful in 2m29s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s

This commit is contained in:
eko
2026-03-16 10:20:15 +07:00
parent d8a12dbcc2
commit fc0669d58e
2 changed files with 60 additions and 19 deletions

View File

@@ -52,25 +52,10 @@ RUN composer run-script post-autoload-dump || echo "Post-autoload dump skipped"
# Generate key if needed
RUN php artisan key:generate --no-interaction --force || true
# Create startup script with runtime directory creation
RUN echo '#!/bin/sh' > /start.sh && \
echo '' >> /start.sh && \
echo '# Ensure storage directories exist at runtime' >> /start.sh && \
echo 'mkdir -p storage/framework/{cache,sessions,views}' >> /start.sh && \
echo 'mkdir -p storage/logs' >> /start.sh && \
echo 'mkdir -p bootstrap/cache' >> /start.sh && \
echo 'chmod -R 777 storage bootstrap/cache' >> /start.sh && \
echo '' >> /start.sh && \
echo '# Start the application based on mode' >> /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
# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 8000 9000
CMD ["/start.sh"]
ENTRYPOINT ["/entrypoint.sh"]