fix: deploy fail

This commit is contained in:
tiennm99 committed 2025-03-15 06:54:24 +07:00
1 parent 6481a83d2f
commit fbcfaf47d8
3 files changed
+37 -8

No files matched your search

+9 -7
View File
@@ -8,6 +8,7 @@ RUN apt-get update && apt-get install -y \
libonig-dev \
libxml2-dev \
libzip-dev \
libicu-dev \
zip \
unzip \
default-mysql-client
@@ -16,7 +17,7 @@ RUN apt-get update && apt-get install -y \
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip xml
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip xml intl
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
@@ -24,17 +25,18 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www/html
# Create tastyigniter project (when container is first built)
RUN composer create-project tastyigniter/tastyigniter:^v4.0 /var/www/html --prefer-dist --no-interaction --no-progress
# Set file permissions
RUN chown -R www-data:www-data /var/www/html
RUN chmod -R 755 /var/www/html/storage
# Instead of running composer create-project during build, we'll do it in the entrypoint
# This allows us to pass the --ignore-platform-req flag if needed
# Copy custom entrypoint
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Set file permissions for the eventual app directory
RUN mkdir -p /var/www/html/storage && \
chown -R www-data:www-data /var/www/html && \
chmod -R 755 /var/www/html
# Entrypoint script
ENTRYPOINT ["entrypoint.sh"]
+13
View File
@@ -89,3 +89,16 @@ If you encounter issues:
2. Verify database connectivity: `docker-compose exec app php artisan db:monitor`
3. Check container status: `docker-compose ps`
4. Ensure proper permissions on the storage directory
### Common Issues
**Missing PHP extensions**
If you see errors about missing PHP extensions like `ext-intl`, the Dockerfile has been updated to include this. However, if you encounter other missing extensions, you can add them to the Dockerfile by:
1. Adding the required dev packages to the `apt-get install` command
2. Adding the extension to the `docker-php-ext-install` command
**Composer installation failures**
If the composer installation fails, you can modify the entrypoint script to use the `--ignore-platform-req` flag. This is included as a fallback in the updated entrypoint script.
+15 -1
View File
@@ -1,6 +1,20 @@
#!/bin/bash
set -e
# Check if TastyIgniter is already installed
if [ ! -f /var/www/html/composer.json ] || [ ! -d /var/www/html/vendor ]; then
echo "Installing TastyIgniter..."
# Create new TastyIgniter project with fallback for handling extension requirements
composer create-project tastyigniter/tastyigniter:^v4.0 /tmp/tastyigniter --prefer-dist --no-interaction --no-progress || \
composer create-project tastyigniter/tastyigniter:^v4.0 /tmp/tastyigniter --prefer-dist --no-interaction --no-progress --ignore-platform-req=ext-intl
# Move files to web root
cp -a /tmp/tastyigniter/. /var/www/html/
rm -rf /tmp/tastyigniter
echo "TastyIgniter files installed"
fi
# Generate app key if not set
if [ -z "$APP_KEY" ]; then
php artisan key:generate
@@ -15,7 +29,7 @@ echo "Database connection established"
# Run TastyIgniter installer in non-interactive mode
if [ ! -f .env ] || ! grep -q "IGNITER_INSTALLED=true" .env; then
echo "Installing TastyIgniter..."
echo "Running TastyIgniter installer..."
php artisan igniter:install --no-interaction
# Mark as installed in .env