I configuring CI for my ASP.NET Core application in VSTS (visual studio online). I've added "docker-compose build" task to build definition but it fails with errors:
Step 4/9 : RUN dotnet restore QuizService.sln && dotnet publish QuizService.sln -c Release -o obj/Docker/publish ---> Running in 7ea0cf1881d1 ... rence = 'SilentlyContinue'; dotnet restore QuizService.sln && dotnet ... The token '&&' is not a valid statement separator in this version. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : InvalidEndOfLine Service 'quizservice' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; dotnet restore QuizService.sln && dotnet publish QuizService.sln -c Release -o obj/Docker/publish' returned a non-zero code: 1 ##[error]Building quizservice ##[error]Service 'quizservice' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; dotnet restore QuizService.sln && dotnet publish QuizService.sln -c Release -o obj/Docker/publish' returned a non-zero code: 1 ##[error]C:\ProgramData\Chocolatey\bin\docker-compose.exe failed with return code: 1
The problem is with my dockerfile on line:
RUN dotnet restore QuizService.sln && dotnet publish QuizService.sln -c Release -o obj/Docker/publish
Somehow docker does not understand '&&' operator: The token '&&' is not a valid statement separator. The exception itself seems to be related to powershell rather than to docker. Poweshell has no '&&' syntax but why it starts using powershell for RUN command here instead of cmd.exe?
It works like a charm when I build locally on my dev machine.
Do somebody faced the same problem?