add two more

This commit is contained in:
mcoder 2026-07-03 22:03:47 +03:30
parent d40e52d74b
commit 0fa86a7b3c
2 changed files with 6 additions and 22 deletions

View File

@ -1,5 +1,5 @@
# =========================
# Stage 1: Dependencies
# Stage 1: Composer build
# =========================
FROM composer:2 AS vendor
@ -7,32 +7,27 @@ WORKDIR /app
COPY . .
# install dependencies cleanly (NO MIRROR, NO DEV)
RUN composer install \
--no-dev \
--prefer-dist \
--no-interaction \
--optimize-autoloader \
--no-scripts
--optimize-autoloader
# =========================
# Stage 2: Runtime
# Stage 2: Runtime image
# =========================
FROM php:8.2-fpm-bookworm
WORKDIR /var/www/html
# system deps
RUN apt-get update && apt-get install -y \
git unzip libzip-dev curl \
&& docker-php-ext-install pdo pdo_mysql zip \
&& rm -rf /var/lib/apt/lists/*
# copy vendor from stage 1
# 👇 کل پروژه + vendor از stage قبل
COPY --from=vendor /app /var/www/html
# permissions
RUN chown -R www-data:www-data /var/www/html
COPY ./docker/php/entrypoint.sh /entrypoint.sh
@ -40,6 +35,3 @@ RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]
EXPOSE 9000
CMD ["php-fpm"]

View File

@ -7,15 +7,7 @@ if [ ! -f .env ]; then
cp .env.example .env
fi
if [ ! -f vendor/autoload.php ]; then
echo "[ERROR] vendor missing - rebuild image"
exit 1
fi
# فقط اگر key وجود نداشت
grep -q "APP_KEY=" .env || php artisan key:generate --force
if ! grep -q "APP_KEY=base64" .env; then
echo "[+] Generating APP KEY"
php artisan key:generate --force
fi
echo "[+] Starting PHP-FPM"
exec php-fpm