Issue with Docker Build

william.j.davis5's Avatar

william.j.davis5

08 Nov, 2018 02:24 PM

Build output: https://ci.appveyor.com/project/Synovia/listenercore/build/job/4kr6...

I'm getting this error:
/usr/share/dotnet/sdk/2.1.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(168,5): error MSB3030: Could not copy the file "obj/Release/netcoreapp2.1/Synovia.Core.Listener.dll" because it was not found. [/app/src/ListenerCore/listenercore.csproj]

Its confusing b/c we are using relative path copying so the fact that its even trying to copy that file tells us that it does in fact exist. Getting the same error on the VS 2017 worker as well as the Ubuntu 18.04 worker.

The command we're running is:
docker build -f Listenercore.Dockerfile --tag synovia/listenercore:$env:APPVEYOR_BUILD_VERSION .

Any thoughts on what we're doing wrong here?

  1. Support Staff 1 Posted by Owen McDonnell on 08 Nov, 2018 07:51 PM

    Owen McDonnell's Avatar

    I'm guessing that you are running dotnet publish command in your dockerfile?
    That command will try to copy those files into a publish folder. Why do you think those files must necessarily exist?

    Maybe you should confirm that via RDP.

  2. 2 Posted by william.j.davis... on 08 Nov, 2018 09:30 PM

    william.j.davis5's Avatar

    My dockerfile uses an intermediate build container, as the msft docs suggest. So when appveyor calls the docker build command it is doing the build inside of the exact same environment that I do it in when I also call docker build locally. So this is one case where I dont feel totally awful saying 'it works on my machine.'

    Dockerfile

    #start with the sdk image, this is where we will perform the build.
    FROM microsoft/dotnet:2.1-sdk AS build
    WORKDIR /app
    
    #copy csproj and restore as distinct layers
    COPY *.sln .
    COPY src/ListenerCore/*.csproj ./src/ListenerCore/
    COPY TestApp/*.csproj ./TestApp/
    RUN dotnet restore
    
    #copy everything else and build app
    COPY src/ListenerCore/. ./src/ListenerCore/
    WORKDIR /app/src/ListenerCore
    RUN dotnet publish -c Release -o out
    
    
    FROM microsoft/dotnet:2.1.5-aspnetcore-runtime AS runtime
    WORKDIR /app
    COPY --from=build /app/src/ListenerCore/out ./
    EXPOSE 20500/udp
    EXPOSE 20800/udp
    EXPOSE 20400/tcp
    EXPOSE 20600/tcp
    ENTRYPOINT ["dotnet", "Synovia.Core.Listener.dll"]
    

    FWIW - I RDP'd in and look, but like I said the build is done inside an intermediate container. That being said, I also ran dotnet build -c Release while I was RDP'd in and it worked well.

  3. 3 Posted by william.j.davis... on 11 Nov, 2018 05:07 PM

    william.j.davis5's Avatar

    Hello, was curious if you had any feedback.

  4. Support Staff 4 Posted by Feodor Fitsner on 12 Nov, 2018 07:46 PM

    Feodor Fitsner's Avatar

    Hi William,

    Is it possible for you to a create a simple "Hello-world" repro project in a public repository? Understanding the structure of your project would help a lot. Is it a single assembly project or assembly project plus test console app using it?

    Thank you in advance!

  5. 5 Posted by william.j.davis... on 14 Nov, 2018 01:54 PM

    william.j.davis5's Avatar

    So you'd like me to create a public repo that mimics the structure of this one?

    It is basically

    ROOT
    -TestApp Folder (this is a console project that is used in doing manual testing) -SRC Folder -Listenercore Folder (console project)

    You can also kind of infer the project structure based on the Dockerfile I've pasted above.

    Thanks,

    Will.

  6. 6 Posted by william.j.davis... on 14 Nov, 2018 03:23 PM

    william.j.davis5's Avatar

    Update here, I added an explicit dotnet build prior to the publish and it seems to have resolved the problem.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac