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

View File

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