This commit is contained in:
mcoder 2026-04-14 14:09:36 +03:30
parent 8db61daaeb
commit 4156a37529
3 changed files with 33 additions and 11 deletions

View File

@ -27,9 +27,9 @@ services:
dockerfile: ./docker/php/Dockerfile
args:
# اینجا می‌توانید آدرس Nexus داخلی سرور خود را بدهید
- COMPOSER_REGISTRY=http://192.168.1.201:8081/
- LINUX_REGISTRY=http://192.168.1.201:8081/
- SECURITY_REGISTRY=http://192.168.1.201:8081/
- COMPOSER_REGISTRY=http://192.168.1.201:8081/repository/composer-runflare/
- LINUX_REGISTRY=http://192.168.1.201:8081/repository/debian-arvan
- SECURITY_REGISTRY=http://192.168.1.201:8081/repository/debian-arvan-security
volumes:
- ./:/var/www/html:rw
networks:

View File

@ -1,35 +1,39 @@
FROM php:8.2-fpm-bookworm
# متغیرهای ریجستری (قابل تنظیم از سمت docker-compose)
# متغیرهای ریجستری
ARG COMPOSER_REGISTRY="https://mirror-composer.runflare.com"
ARG LINUX_REGISTRY="http://deb.debian.org/debian"
ARG SECURITY_REGISTRY="http://security.debian.org/debian-security"
# تغییر سورس‌های apt به ریجستری لوکال/کاستوم شما
# تغییر سورس‌های apt
RUN sed -i "s|http://deb.debian.org/debian|${LINUX_REGISTRY}|g" /etc/apt/sources.list.d/debian.sources \
&& sed -i "s|http://security.debian.org/debian-security|${SECURITY_REGISTRY}|g" /etc/apt/sources.list.d/debian.sources \
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99ignore \
&& echo 'Acquire::AllowInsecureRepositories "true";' >> /etc/apt/apt.conf.d/99ignore
# نصب وابستگی‌های پایه (بدون دیتابیس چون فعلاً نیاز نداریم)
# نصب nodejs و npm در کنار سایر وابستگی‌ها
RUN apt-get update && apt-get install -y --allow-downgrades --no-install-recommends \
libzip-dev \
unzip \
git \
curl \
nodejs \
npm \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# نصب اکستنشن‌های پایه PHP
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions zip bcmath
# تنظیمات کامپوزر و استفاده از ریجستری
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
ENV COMPOSER_ALLOW_SUPERUSER=1
# غیرفعال کردن JIT برای جلوگیری از باگ‌های احتمالی PCRE
RUN echo "pcre.jit=0" > /usr/local/etc/php/conf.d/disable-pcre-jit.ini
CMD ["php-fpm"]
# === [ بخش جدید: اضافه کردن Entrypoint ] ===
COPY ./docker/php/entrypoint.sh /usr/local/bin/entrypoint.sh
# دادن دسترسی اجرا به فایل
RUN chmod +x /usr/local/bin/entrypoint.sh
# واگذاری کنترل اجرای کانتینر به اسکریپت ما
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

18
docker/php/entrypoint.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# توقف اجرا در صورت بروز خطای بحرانی
set -e
echo "[+] Starting Initialization Process..."
# بررسی و نصب پکیج‌های NPM
echo "[+] Installing NPM dependencies..."
npm install
# کامپایل کردن فایل‌های Tailwind و Alpine برای پروداکشن
echo "[+] Building frontend assets..."
npm run build
# راه‌اندازی سرویس اصلی (PHP-FPM)
echo "[+] Starting PHP-FPM for Browser-Sec-Lab..."
exec php-fpm