So i have a solution structure like this:
sln
--.sln
--docker-compose
--nuget.config
|
---- Project1
------ src
-------- Project1
---------- csproj
---------- Dockerfile
I am trying to do something like this in my dockerfile but it is saying that the nuget.config
doesn't exist : failed to compute cache key: "../../../nuget.config" not found: not found
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
WORKDIR /app
ENV NUGET_USER=user
ARG NUGET_TOKEN
ENV NUGET_TOKEN=$NUGET_TOKEN
# Copy csproj and restore as distinct layers
COPY ["Project1.csproj", "./"]
COPY ../../../nuget.config ./
RUN dotnet restore "./Project1.csproj"
# Copy everything else and build
COPY . ./
RUN dotnet build "Project1.csproj" -c Release -o /app/build
FROM build-env AS publish
RUN dotnet publish "Project1.csproj" -c Release -o /app/out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:5.0
#WORKDIR /app
COPY --from=publish /app/out .
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
ENTRYPOINT ["dotnet", "Project1.dll"]
if I change COPY ../../nuget.config ./
to COPY ./nuget.config ./
and add a copy of my nuget.cofig
to the project1 directory, it runs fine, but i don't want to have to duplicate that file across each project.
My intellisense recognized the path i am trying as valid, but i assume when i do my docker compose that it is actually living somewhere else. What's the proper syntax to account for this?