0

I have a big problem: I have to copy a .dll file into my Docker Image. I can't pull it from NuGet, because it's a private package and you can't pull it normally via a url and nuget.config. I asked my colleagues and they said I should copy the file into the Docker Image. Does someone have an idea how to do it?

I have copied this .dll file into my normal project directory. But I have no idea where to copy it or how to do that.

This is my DockerFile:


FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["DoKiva/DoKiva.csproj", "DoKiva/"]
RUN dotnet restore "DoKiva/DoKiva.csproj"
COPY . .
WORKDIR "/src/DoKiva"
RUN dotnet build "DoKiva.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "DoKiva.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DoKiva.dll"] 

If you could help me I would really appreciate it!

My Docker Build Command is docker build -t dokivac .

Palle Due
  • 5,929
  • 4
  • 17
  • 32
MaxinhoHD
  • 49
  • 1
  • 6

1 Answers1

0

The COPY command is what does this. It's first parameter is the source, relative to the Dockerfile and the second is the destination, relative to the current WORKDIR. You can use it to copy entire folders or single files. However as build is being run, have you tried just importing the DLL in your Visual Studio project, selecting properties and than copy the file as a build action. This way the DLL will be automatically moved to your build directory?