I am creating a docker image using visual studio console application and the dockerfile looke like:
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS base
RUN dotnet new --install MyCustomTemplate::1.0.0
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["DockerTemplates/DockerTemplates.csproj", "DockerTemplates/"]
RUN dotnet restore "DockerTemplates/DockerTemplates.csproj"
COPY . .
WORKDIR "/src/DockerTemplates"
RUN dotnet build "DockerTemplates.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "DockerTemplates.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DockerTemplates.dll"]
After creating the image from sdk, I have called the command to install the custom template using the command:
RUN dotnet new --install MyCustomTemplate::1.0.0
But when the image is created, I don't find my custom template in my docker image.
How can I install custom templates inside a image during creation of the image? Anybody can help?
Thanks