mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
feat(stack): 新增 docker-dev 开发模式
- 新增 source/stack/docker-dev/Dockerfile: 基于 full 模式 + Xdebug + 开发 PHP 配置 - 新增 source/stack/docker-dev/docker-compose.yaml: 4 服务编排 (app/mysql/redis/phpmyadmin) - 新增 source/stack/docker-dev/.docker-dev.env: 开发环境配置模板 (HOSTNAME=mysql, HOSTPORT=3306) - 更新 source/stack/stack.json: 注册 docker-dev 模式, managed_files 增加 .docker-dev.env - 更新 .gitignore: 排除 /docker-dev/ 数据目录
This commit is contained in:
97
source/stack/docker-dev/Dockerfile
Normal file
97
source/stack/docker-dev/Dockerfile
Normal file
@@ -0,0 +1,97 @@
|
||||
FROM php:8.2-fpm-bookworm
|
||||
|
||||
RUN rm -rf /etc/apt/sources.list.d/* \
|
||||
&& echo "deb http://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list \
|
||||
&& echo "deb http://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list \
|
||||
&& echo "deb http://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
# Install nginx
|
||||
RUN apt-get install -y nginx
|
||||
|
||||
ADD --chmod=0755 https://nexus.hl7.top:1243/repository/github-raw-proxy/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
|
||||
|
||||
# Configure proxy
|
||||
RUN sed -i 's|aomedia.googlesource.com|nexus.hl7.top:1243/repository/raw-aomedia.googlesource.com|g' /usr/local/bin/install-php-extensions
|
||||
RUN sed -i 's|chromium.googlesource.com|nexus.hl7.top:1243/repository/raw-chromium.googlesource.com|g' /usr/local/bin/install-php-extensions
|
||||
RUN sed -i 's|https://github.com|https://nexus.hl7.top:1243/repository/github-raw-proxy|g' /usr/local/bin/install-php-extensions
|
||||
|
||||
RUN install-php-extensions pdo_mysql
|
||||
RUN install-php-extensions gd
|
||||
RUN install-php-extensions fileinfo
|
||||
RUN install-php-extensions opcache
|
||||
RUN install-php-extensions redis
|
||||
RUN install-php-extensions event
|
||||
RUN install-php-extensions imagick
|
||||
RUN install-php-extensions zip
|
||||
RUN install-php-extensions pcntl
|
||||
RUN install-php-extensions xdebug
|
||||
|
||||
# Clean default Nginx config
|
||||
RUN rm /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
|
||||
|
||||
|
||||
# Install other dependencies
|
||||
# RUN apt-get install -y ffmpeg
|
||||
# RUN apt-get install -y libreoffice
|
||||
# RUN apt-get install -y redis-server
|
||||
# RUN apt-get install -y git
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Install Composer
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
|
||||
RUN chmod +x /usr/local/bin/composer
|
||||
RUN composer config -g repos.packagist composer https://nexus.hl7.top:1243/repository/composer-proxy/
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Pre-copy composer files and install dependencies (with dev packages)
|
||||
COPY composer.json composer.lock /var/www/html/
|
||||
RUN composer install --no-interaction --no-scripts
|
||||
|
||||
# Copy all files to working directory
|
||||
COPY . /var/www/html
|
||||
|
||||
# Generate autoloader (without --no-dev optimizations)
|
||||
RUN composer dump-autoload
|
||||
|
||||
# Internal install composer and dependencies, comment out if not needed
|
||||
# RUN install-php-extensions @composer
|
||||
|
||||
# Dev mode PHP config (overrides zz-phprun.ini)
|
||||
RUN echo '; Dev mode PHP config (overrides zz-phprun.ini)' > /usr/local/etc/php/conf.d/zzz-dev.ini && \
|
||||
echo 'opcache.enable = 0' >> /usr/local/etc/php/conf.d/zzz-dev.ini && \
|
||||
echo 'opcache.jit_buffer_size = 0' >> /usr/local/etc/php/conf.d/zzz-dev.ini && \
|
||||
echo 'display_errors = On' >> /usr/local/etc/php/conf.d/zzz-dev.ini && \
|
||||
echo 'error_reporting = E_ALL' >> /usr/local/etc/php/conf.d/zzz-dev.ini
|
||||
|
||||
# Xdebug dev config
|
||||
RUN echo '; Xdebug dev config' > /usr/local/etc/php/conf.d/zzz-xdebug.ini && \
|
||||
echo 'xdebug.mode = debug,develop' >> /usr/local/etc/php/conf.d/zzz-xdebug.ini && \
|
||||
echo 'xdebug.start_with_request = trigger' >> /usr/local/etc/php/conf.d/zzz-xdebug.ini && \
|
||||
echo 'xdebug.client_host = host.docker.internal' >> /usr/local/etc/php/conf.d/zzz-xdebug.ini && \
|
||||
echo 'xdebug.client_port = 9003' >> /usr/local/etc/php/conf.d/zzz-xdebug.ini && \
|
||||
echo 'xdebug.discover_client_host = true' >> /usr/local/etc/php/conf.d/zzz-xdebug.ini && \
|
||||
echo 'xdebug.idekey = DOCKER_DEV' >> /usr/local/etc/php/conf.d/zzz-xdebug.ini
|
||||
|
||||
VOLUME /var/www/html/runtime
|
||||
VOLUME /var/www/html/public/storage
|
||||
VOLUME /var/www/html/public/build
|
||||
VOLUME /var/www/html/storage
|
||||
|
||||
# Mount main directory, alternatively mount the main directory directly and remove the specific volumes above
|
||||
# VOLUME ["/var/www/html"]
|
||||
|
||||
# Expose Nginx port
|
||||
EXPOSE 80
|
||||
|
||||
RUN chmod +x /var/www/html/docker/run.sh
|
||||
|
||||
# Start Nginx and PHP-FPM
|
||||
ENTRYPOINT ["/bin/bash", "/var/www/html/docker/run.sh"]
|
||||
|
||||
CMD ["server"]
|
||||
Reference in New Issue
Block a user