
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
包含构建和测试PHP应用所需一切的Docker镜像
!https://raw.githubusercontent.com/edbizarro/gitlab-ci-pipeline-php/master/gitlab-ci-pipeline-php.png
!GitHub最后提交 、Composer(带有 https://github.com/hirak/prestissimo 以加速安装)、Node 和 Yarn。
满足您测试 Laravel 项目所需的一切 :D
要运行 Dusk 测试,我们需要在镜像上安装 chromium,因此我们为此提供了特殊标签。
7.4-chromium https://github.com/edbizarro/gitlab-ci-pipeline-php/blob/master/php/7.4/chromium/Dockerfile 7.3-chromium https://github.com/edbizarro/gitlab-ci-pipeline-php/blob/master/php/7.3/chromium/Dockerfile 7.2-chromium https://github.com/edbizarro/gitlab-ci-pipeline-php/blob/master/php/7.2/chromium/Dockerfile 有关更多详细信息,请查看 Dusk 示例。
使用 mysql 服务的简单 .gitlab-ci.yml
yaml# 变量 variables: MYSQL_ROOT_PASSWORD: root MYSQL_USER: homestead MYSQL_PASSWORD: secret MYSQL_DATABASE: homestead DB_HOST: mysql test: stage: test services: - mysql:5.7 image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine script: - yarn install --pure-lockfile - composer install --prefer-dist --no-ansi --no-interaction --no-progress - cp .env.example .env - php artisan key:generate - php artisan migrate:refresh --seed - ./vendor/phpunit/phpunit/phpunit -v --coverage-text --colors=never --stderr
使用 mysql 服务、多阶段和缓存的高级 .gitlab-ci.yml
yamlstages: - test - deploy # 变量 variables: MYSQL_ROOT_PASSWORD: root MYSQL_USER: homestead MYSQL_PASSWORD: secret MYSQL_DATABASE: homestead DB_HOST: mysql # 加速构建 cache: key: $CI_BUILD_REF_NAME # 在 Gitlab 9.x 中改为 $CI_COMMIT_REF_NAME paths: - vendor - node_modules - public - .yarn test: stage: test services: - mysql:5.7 image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine script: - yarn config set cache-folder .yarn - yarn install --pure-lockfile - composer install --prefer-dist --no-ansi --no-interaction --no-progress - cp .env.example .env - php artisan key:generate - php artisan migrate:refresh --seed - ./vendor/phpunit/phpunit/phpunit -v --coverage-text --colors=never --stderr artifacts: paths: - ./storage/logs # 用于调试 expire_in: 7 days when: always deploy: stage: deploy image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine script: - echo "部署所有内容!" only: - master when: on_success
使用 mysql 服务和缓存的 Laravel Dusk 测试 .gitlab-ci.yml
yamlstages: - test # 变量 variables: MYSQL_ROOT_PASSWORD: root MYSQL_USER: homestead MYSQL_PASSWORD: secret MYSQL_DATABASE: homestead DB_HOST: mysql # 加速构建 cache: key: $CI_BUILD_REF_NAME # 在 Gitlab 9.x 中改为 $CI_COMMIT_REF_NAME paths: - vendor - node_modules - public - .yarn test: stage: test services: - mysql:5.7 image: edbizarro/gitlab-ci-pipeline-php:7.4-chromium script: - yarn config set cache-folder .yarn - yarn install --pure-lockfile - composer install --prefer-dist --no-ansi --no-interaction --no-progress - cp .env.example .env - php artisan key:generate - php artisan migrate:refresh --seed - php artisan serve & - ./vendor/laravel/dusk/bin/chromedriver-linux --port=9515 & - sleep 5 - php artisan dusk artifacts: paths: - ./storage/logs # 用于调试 - ./tests/Browser/screenshots # 用于 Dusk 截图 - ./tests/Browser/console expire_in: 7 days when: always
推荐工具
特别感谢 https://github.com/codecasts/ambientum%EF%BC%8C%E4%B8%80%E4%B8%AA%E5%BE%88%E6%A3%92%E7%9A%84%E5%B7%B4%E8%A5%BF%E9%A1%B9%E7%9B%AE%EF%BC%8C%E6%8F%90%E4%BE%9B%E4%BA%86%E7%81%B5%E6%84%9F%E3%80%82
同时感谢 https://github.com/Chialab/docker-php 提供的 PHP 7.2 构建脚本






来自真实用户的反馈,见证轩辕镜像的优质服务