作者:手机用户2502912197 | 来源:互联网 | 2023-01-22 12:01
给定这样的文件结构:
project root
|-- X.sln
|-- src
| |-- Foo
| | |-- Foo.fsproj
| | |-- Foo.fs
| |-- Bar
| |-- Bar.fsproj
| |-- Bar.fs
|-- test
|-- Baz
|-- Baz.fsproj
我想首先将所有.fsproj
文件添加到我的Docker镜像,然后运行命令,然后添加其余文件.我尝试了以下,但当然它不起作用:
COPY X.sln .
COPY **/*.fsproj .
RUN dotnet restore
COPY . .
RUN dotnet build
这个想法是在前两个COPY
步骤之后,图像上的文件树是这样的:
working dir
|-- X.sln
|-- src
| |-- Foo
| | |-- Foo.fsproj
| |-- Bar
| |-- Bar.fsproj
|-- test
|-- Baz
|-- Baz.fsproj
树的其余部分仅在之后 添加RUN dotnet restore
.
有没有办法模仿这种行为,最好不要求助于dockerfile之外的脚本?