gpt4 book ai didi

docker - 排除 .dockerignore 中的文件夹

转载 作者:行者123 更新时间:2023-12-02 18:40:26 29 4
gpt4 key购买 nike

我试图阻止我的 Drupal Composer 项目中的文件和文件夹列表包含在 docker 镜像中,但作为意外的副作用,它还排除了一些未在 .dockerignore 中明确定义的文件夹。这是我正在处理的文件:

# root files
.gitignore
.gitmodules
.travis.yml
.gitlab-ci.yml
docker-compose.yml
LICENSE
phpunit.xml.dist
README.md

# folders
.c9
.git
backups/
vendor/
web/core/
web/modules/contrib/
web/profiles/
web/themes/contrib/

# web files
web/.csslintrc
web/.editorconfig
web/.eslintrc
web/.eslintignore
web/.gitattributes
web/.htaccess

# web sites files
web/sites/development.services.yml
web/sites/example.settings.local.php
web/sites/example.sites.php

# web sites default files
web/sites/default/files/
web/sites/default/default.services.yml
web/sites/default/settings.local.php

<all combinations of lines below, one at a time>

我已经定义了我想要包含在底部的文件夹,我已经尝试了下面我能想到的所有组合。到目前为止运气不好,没有什么可以尝试的了。

# don't ignore comes last
!web/themes/custom
!web/libraries

# don't ignore comes last
!web/themes/custom/
!web/libraries/

# don't ignore comes last
!web/themes/custom/*
!web/libraries/*

# don't ignore comes last
*!web/themes/custom/*
*!web/libraries/*

我还尝试取消注释每个文件夹,但 web/themes/customweb/libraries 文件夹仍然没有出现在我的 docker 镜像中。我还有一个包含这些文件夹的 .gitignore 文件。也许这是造成这种奇怪行为的原因?

如有任何帮助,我们将不胜感激。

最佳答案

我正在使用 Gitlab CI 构建图像,但我忘记了我的 git 存储库没有我试图复制的文件夹。只有我的本地开发环境有文件夹。

关于docker - 排除 .dockerignore 中的文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42888502/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com