【发布时间】:2018-05-01 20:36:57
【问题描述】:
我想在 docker 容器中运行 dotnet test 命令,但我无法弄清楚该命令的放置位置。该项目是一个 .NET Core 2.1 测试项目。这样做的原因是我想运行端到端集成测试,这需要我的所有容器都在运行。
Docker 文件:
FROM microsoft/dotnet:2.1-runtime AS base
WORKDIR /app
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY *.sln ./
COPY Sombra.IntegrationTests/Sombra.IntegrationTests.csproj Sombra.IntegrationTests/
COPY . .
WORKDIR /src/Sombra.IntegrationTests
RUN dotnet build -c Release -o /app
FROM build AS publish
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "test", "Sombra.IntegrationTests.csproj"]
docker-compose.yml
version: '3'
services:
sombra.integrationtests:
image: sombra.integrationtests
build:
context: .
dockerfile: Sombra.IntegrationTests/Dockerfile
depends_on:
- rabbitmq
【问题讨论】:
标签: docker .net-core docker-compose