• 在 Dockerfile 中,如果你想在 COPY 命令中忽略 .git/ 目录,可以使用 .dockerignore 文件来实现,这是 Docker 的标准做法。

创建 /.dockerignore 文件

.git/