ahebrank/docker-d8

该软件包最新版本(dev-master)没有可用的许可证信息。

D8 Docker项目骨架

dev-master 2017-02-02 01:55 UTC

This package is not auto-updated.

Last update: 2024-09-15 02:42:59 UTC


README

D8-in-docker设置骨架。主要目标是尽可能将除自定义模块和主题之外的所有内容放在容器内(并从仓库中移除)。

为此,使用 composer 安装依赖,但它在PHP容器内运行。将 modulesthemes 目录映射到容器,但仅应用于 custom 内容。

有一些实用函数用于安装和更新核心/模块。

快速入门

  • 将此克隆/复制到新项目:composer create-project ahebrank/docker-d8 YOUR-PROJECT-DIR --stability dev
  • 运行 docker-compose up --build 来启动容器网络
  • 浏览到 https://:8000 来设置您的网站。数据库和应用文件保存在持久存储容器中

管理

一组 d 工具在容器内透明地运行操作。

  • 要安装模块:例如,./dcomposer require drupal/paragraphs(接受composer版本信息)
  • Drupal控制台:./ddrupal
  • Drush:./ddrush
  • 进入Drupal容器shell:./d

调整

补丁

在composer.json中添加一个部分,列出每个模块的补丁。例如

"patches": {
    "drupal/better_formats": {
        "Paragraphs integration": "https://www.drupal.org/files/issues/better_formats_paragraphs-2754029-15.patch"
    },
    "drupal/cshs": {
        "Show stuff by default": "https://www.drupal.org/files/issues/cshs-no_default_filter-2781511-4.patch",
        "Allow default options": "https://www.drupal.org/files/issues/fix-default-val-views-error-2797349-1.patch",
        "Accessible labels": "patches/cshs-accessibility.patch"
    },
    "drupal/paragraphs": {
        "IEF save problem": "patches/saving_problem_in-2804377-x.patch"
    },
    "drupal/feeds": {
        "Dynamic sources": "https://www.drupal.org/files/issues/feeds-dynamic_mapping_sources-2443471-4.patch"
    },
    "drupal/devel": {
        "Shorten max depth": "patches/kint_max_levels.patch"
    },
    "drupal/field_group": {
        "Don't force on the front end": "https://www.drupal.org/files/issues/field_group-check-for-empty-render-key-2825389-4.patch"
    },
    "drupal/cdn": {
        "No CDN when logged in": "patches/cdn_not_when_logged_in.patch"
    },
    "drupal/eck": {
        "Fix schema": "https://www.drupal.org/files/issues/changes_to-2825407-6.patch"
    }
}

将dev贡献模块包含在仓库中

Composer使用包括 .git 目录在内的dev模块(来自git仓库)进行安装。当根存储库看到这些 .git 目录时,它将模块存储为gitlink(基本上是不完整的子模块)。这通常没问题,但如果您在不进行任何构建的情况下将这些模块包含在部署工件中(即通过 composer 安装它们),则模块没有实际内容,因此不能成为工件的一部分。解决方案是添加一个composer post-install脚本以删除模块 .git 目录。将以下内容添加到您的composer.json的 autoload 部分

"autoload": {
    "classmap": [
        "utils/composer/RemoveGit.php"
    ]
},

并添加到 scripts 部分

"scripts": {
    "post-install-cmd": [
        "DrupalNewCity\\composer\\RemoveGit::removeModuleGit"
    ],
    "post-update-cmd": [
        "DrupalNewCity\\composer\\RemoveGit::removeModuleGit"
    ]
},