I'm currently trying to dockerize a .net core API on my laptop but when I'm building the docker file I have some issue.
I have an issue when it's trying to execute commands like choco or wget. It says that they are not recognized, I did install them though and added as variables into my environment. They do work when I try to execute them independently in a terminal.
Here my script:
FROM microsoft/dotnet:2.2-sdk AS dotnet-builder
ARG nuget_pat
# Set environment variables
ENV NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED true
ENV VSS_NUGET_EXTERNAL_FEED_ENDPOINTS '{"endpointCredentials":[{"endpoint":"https://isirac.pkgs.visualstudio.com/_packaging/RentacarMicroserviceNuget/nuget/v3/index.json","username":"NoRealUserNameAsIsNotRequired","password":"'${nuget_pat}'"}]}'
RUN choco install wget
# Get and install the Artifact Credential provider
RUN wget -O - https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
# Restore your nugets from nuget.org and your private feed.
# RUN dotnet restore -s "https://isirac.pkgs.visualstudio.com/_packaging/RentacarMicroserviceNuget/nuget/v3/index.json" -s "https://api.nuget.org/v3/index.json" "Suzuki.csproj"
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1909 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1909 AS build
WORKDIR "/src/Suzuki/Suzuki/"
COPY ["*.csproj", "./"]
# COPY --from=nuget-config NuGet.config ./
RUN dotnet restore --interactive "Suzuki.csproj" -s "https://isirac.pkgs.visualstudio.com/_packaging/RentacarMicroserviceNuget/nuget/v3/index.json" -s "https://api.nuget.org/v3/index.json"
COPY . .
WORKDIR "/src/Suzuki/Suzuki/"
RUN dotnet build "Suzuki.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Suzuki.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Suzuki.dll"]
Does anyone have a clue?
thanks