Tit*_*oto 3 unit-testing docker .net-core dockerfile docker-compose
在 dockerfile 中使用具有相对路径的复制命令有相同的方法吗?我尝试使用:
COPY ./../folder/*.csproj ./
Run Code Online (Sandbox Code Playgroud)
OBS。:我的结构文件夹(我在项目测试上运行dockerfile,另一个文件在项目控制台文件夹中)是:
|- 项目控制台
|- 项目测试
我收到以下错误:
错误:服务“应用程序”无法构建:复制失败:未指定源文件。
我的目的是在同一个 docker 中有两个项目。我有一个 dotnet 核心控制台,另一个带有统一测试 (NUnity),我尝试在 docker 中运行统一测试。
更新
可以使用多阶段:https : //docs.docker.com/develop/develop-images/multistage-build/
或者使用 docker-compose 构建:https : //docs.docker.com/engine/reference/commandline/build/
喜欢:
services:
worker:
build:
context: ./workers
dockerfile: Dockerfile
Run Code Online (Sandbox Code Playgroud)
你可以试试这个方法
$ cd project-console
$ docker build -f ../project-test/Dockerfile .
Run Code Online (Sandbox Code Playgroud)
更新:
通过使用 docker-compose
build:
context: ../
dockerfile: project-test/Dockerfile
Run Code Online (Sandbox Code Playgroud)
../将被设置为上下文,在你的情况下它应该包括 project-console 和 project-test 。这样你就可以COPY在 Dockerfile 中 project-console/*.csproj。
| 归档时间: |
|
| 查看次数: |
11591 次 |
| 最近记录: |