【发布时间】:2019-07-23 13:23:37
【问题描述】:
我正在尝试运行这个 dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
WORKDIR /app
COPY . ./
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.5.0/wait /wait
#RUN chmod +x /wait
RUN /bin/bash -c 'ls -la /wait; chmod +x /wait; ls -la /wait'
CMD /wait && dotnet test --logger trx --results-directory /var/temp /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura && mv /app/tests/Ardalis.Specification.UnitTests/coverage.cobertura.xml /var/temp/coverage.unit.cobertura.xml && mv /app/tests/Ardalis.Specification.IntegrationTests/coverage.cobertura.xml /var/temp/coverage.integration.cobertura.xml
它在我的本地 Windows 机器上运行良好(使用上面第 6-7 行显示的任一 RUN 命令)。
但是当我在 Azure Pipelines 中运行脚本作为构建的一部分时,我得到了这个错误:
我不确定为什么它在 Azure DevOps 中的行为与在我的本地(Windows)机器上的行为不同。构建服务器是 'windows-2019' 映像。它作为 docker-compose 的一部分运行,如果有帮助,请使用此文件:
version: '3.4'
services:
tests:
build:
context: .
dockerfile: Dockerfile
environment:
WAIT_HOSTS: database:1433
volumes:
- ./TestResults:/var/temp
database:
image: mcr.microsoft.com/mssql/server:2017-CU8-ubuntu
environment:
SA_PASSWORD: "P@ssW0rd!"
ACCEPT_EULA: "Y"
您可以在此处查看完整的构建跟踪:https://dev.azure.com/Ardalis-Specification/Ardalis.Specification/_build/results?buildId=32
您可以在此处查看 Azure 管道和完整源代码: https://github.com/ardalis/Specification/pull/1
【问题讨论】:
-
可能构建镜像默认设置为运行windows容器。使用为 Windows 配置的 docker 在本地尝试我的构建脚本......繁荣!同样的错误!
-
好的,那么如何在我的构建脚本中包含这需要在 Docker for Linux 上运行?
-
在您的 dockerfile 的同一级别有一个名为
wait的文件,该文件被复制到 imge 中。该文件可能在远程服务器上不存在
标签: azure docker docker-compose azure-devops