Getting "COPY failed: no source files were specified" when trying to build with docker
I have a Visual Studio project with structure like this
|--.dockerignore |--Dockerfile |--SanSa.sln |--SanSa.Web (folder) |--SanSa.Web.csproj |--SanSa.WebAdmin (folder) |--SanSa.WebAdmin.csproj |--SanSa.DataAccess (folder) |--SanSa.DataAccess.csproj
I'm trying to deploy SanSa.Web, my Dockerfile content is as follows
FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /app # copy csproj and restore as distinct layers COPY *.sln . COPY Sansa.Web/*.csproj ./SanSa.Web/ RUN dotnet restore # copy everything else and build app COPY SanSa.Web/. ./SanSa.Web/ WORKDIR /app/SanSa.Web RUN dotnet publish -c Release -o out FROM microsoft/dotnet:2.1-aspnetcore-runtime AS runtime WORKDIR /app COPY --from=build /app/SanSa.Web/out ./ ENTRYPOINT ["dotnet", "SanSa.Web.dll"]
My .ignoredocker
# directories **/bin/ **/obj/ **/out/ # files Dockerfile* **/*.trx **/*.md
When I run docker build --tag sansa:latest -f Dockerfile . I got this error
Step 4/12 : COPY SanSa/*.csproj ./SanSa/ COPY failed: no source files were specified
Any idea why?
0 comments:
Post a Comment