I am trying to follow sitecore 10 example in docker (https://containers.doc.sitecore.com/docs/build-solution) and as an out of box step worked correctly, I am having issue on step 6 with build solution. Every time resulting with an error below:
PS K:\docker-examples\custom-images> docker-compose build solution
Building solution
Step 1/21 : ARG BASE_IMAGE
Step 2/21 : ARG BUILD_IMAGE
Step 3/21 : FROM ${BUILD_IMAGE} AS prep
---> a1f61ee40a8e
Step 4/21 : COPY *.sln nuget.config Directory.Build.targets Packages.props \nuget\
---> Using cache
---> 2ad252c633e3
Step 5/21 : COPY src\ \temp\
---> Using cache
---> a2855d9bc5d3
Step 6/21 : RUN Invoke-Expression 'robocopy C:\temp C:\nuget\src /s /ndl /njh /njs *.csproj *.scproj packages.config'
---> Running in c911b9d4e67d
'Invoke-Expression' is not recognized as an internal or external command,
operable program or batch file.
ERROR: Service 'solution' failed to build : The command 'cmd /S /C Invoke-Expression 'robocopy C:\temp C:\nuget\src /s /ndl /njh /njs *.csproj *.scproj packages.config'' returned a non-zero code: 1
Powershell version: 5.1.19041.610, Windows version: 20H2
Update: Docker file added
# escape=`
ARG BASE_IMAGE
ARG BUILD_IMAGE
FROM ${BUILD_IMAGE} AS prep
# Gather only artifacts necessary for NuGet restore, retaining directory structure
COPY *.sln nuget.config Directory.Build.targets Packages.props \nuget\
COPY src\ \temp\
RUN Invoke-Expression 'robocopy C:\temp C:\nuget\src /s /ndl /njh /njs *.csproj *.scproj packages.config'
FROM ${BUILD_IMAGE} AS builder
ARG BUILD_CONFIGURATION
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Create an empty working directory
WORKDIR C:\build
# Copy prepped NuGet artifacts, and restore as distinct layer to take better advantage of caching
COPY --from=prep .\nuget .\
RUN nuget restore
# Copy remaining source code
COPY src\ .\src\
# Copy transforms, retaining directory structure
RUN Invoke-Expression 'robocopy C:\build\src C:\out\transforms /s /ndl /njh /njs *.xdt'
# Build website with file publish
RUN msbuild .\src\DockerExamples.Website\DockerExamples.Website.csproj /p:Configuration=$env:BUILD_CONFIGURATION /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:PublishUrl=C:\out\website
# Build XConnect with file publish
RUN msbuild .\src\DockerExamples.XConnect\DockerExamples.XConnect.csproj /p:Configuration=$env:BUILD_CONFIGURATION /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:PublishUrl=C:\out\xconnect
FROM ${BASE_IMAGE}
WORKDIR C:\artifacts
# Copy final build artifacts
COPY --from=builder C:\out\website .\website\
COPY --from=builder C:\out\transforms .\transforms\
COPY --from=builder C:\out\xconnect .\xconnect\