Compare commits

...

3 Commits

3 changed files with 34 additions and 7 deletions

View File

@@ -50,7 +50,8 @@ services:
- PMA_PORT=${DB_PORT:-3306} - PMA_PORT=${DB_PORT:-3306}
- UPLOAD_LIMIT=100M - UPLOAD_LIMIT=100M
depends_on: depends_on:
- mysql mysql:
condition: service_started
volumes: volumes:
mysql-data: mysql-data:

View File

@@ -18,7 +18,6 @@ RUN apt-get update && apt-get install -y \
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY ./docker/php-fpm.conf /usr/local/etc/php-fpm.d/zz-docker.conf COPY ./docker/php-fpm.conf /usr/local/etc/php-fpm.d/zz-docker.conf
COPY ./docker/docker-entrypoint.sh /usr/local/bin/ COPY ./docker/docker-entrypoint.sh /usr/local/bin/
@@ -26,6 +25,7 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN groupadd -g $GID laravel && useradd -u $UID -g $GID -m laravel RUN groupadd -g $GID laravel && useradd -u $UID -g $GID -m laravel
USER laravel USER laravel
WORKDIR /var/www WORKDIR /var/www
EXPOSE 9000 EXPOSE 9000

View File

@@ -3,13 +3,19 @@ set -e
cd /var/www cd /var/www
echo ">> Running in ${APP_ENV:-unknown} mode"
if [ -f "artisan" ]; then if [ -f "artisan" ]; then
chown -R laravel:laravel /var/www/storage /var/www/bootstrap/cache chown -R laravel:laravel storage bootstrap/cache
chmod -R 775 /var/www/storage /var/www/bootstrap/cache chmod -R 775 storage bootstrap/cache
if [ ! -d "vendor" ]; then if [ ! -d "vendor" ]; then
echo ">> Installing composer dependencies..." echo ">> Installing composer dependencies..."
composer install --optimize-autoloader if [ "$APP_ENV" = "production" ]; then
composer install --no-dev --optimize-autoloader
else
composer install --optimize-autoloader
fi
else else
echo ">> Vendor directory exists, skipping installation" echo ">> Vendor directory exists, skipping installation"
fi fi
@@ -28,8 +34,28 @@ if [ -f "artisan" ]; then
echo ">> Running migrations..." echo ">> Running migrations..."
php artisan migrate --force || true php artisan migrate --force || true
echo ">> Running seeders..." if [ ! -L "public/storage" ] && [ -d "storage/app/public" ]; then
php artisan db:seed --force || true echo ">> Creating storage link..."
php artisan storage:link
else
echo ">> Storage link already exists or storage directory missing"
fi
if [ "$APP_ENV" = "local" ]; then
echo ">> Running seeders..."
php artisan db:seed --force || true
if composer show knuckleswtf/scribe > /dev/null 2>&1; then
echo ">> Generating API documentation..."
php artisan scribe:generate --no-interaction || echo ">> Documentation generation failed, continuing..."
else
echo ">> Scribe not installed, skipping documentation generation"
fi
fi
if [ "$APP_ENV" = "production" ]; then
php artisan optimize
fi
else else
echo ">> Not a Laravel project" echo ">> Not a Laravel project"
fi fi