FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG AZURE_DEVOPS_ACCESS_TOKEN
ENV HTTP_PROXY ${HTTP_PROXY}
ENV HTTPS_PROXY ${HTTPS_PROXY}
ENV AZURE_DEVOPS_ACCESS_TOKEN ${AZURE_DEVOPS_ACCESS_TOKEN}
WORKDIR /src
COPY ["src/WIS.WebAPI.SharedServices/WIS.WebAPI.SharedServices.csproj", "src/WIS.WebAPI.SharedServices/"]
COPY ["src/WIS.WebAPI.ApplicationServices/WIS.WebAPI.ApplicationServices.csproj", "src/WIS.WebAPI.ApplicationServices/"]
COPY ["src/WIS.WebAPI.DataAccess/WIS.WebAPI.DataAccess.csproj", "src/WIS.WebAPI.DataAccess/"]
COPY ["src/WIS.WebAPI.Models/WIS.WebAPI.Models.csproj", "src/WIS.WebAPI.Models/"]
COPY ["src/WIS.StatusCodes/WIS.SharedServices.StatusCodes.csproj", "src/WIS.StatusCodes/"]
COPY ["src/WIS.WebAPI.Enums/WIS.WebAPI.SharedServices.Enums.csproj", "src/WIS.WebAPI.Enums/"]
COPY ["src/WIS.WebAPI.SharedServices.DTOs/WIS.WebAPI.SharedServices.DTOs.csproj", "src/WIS.WebAPI.SharedServices.DTOs/"]
COPY ["src/WIS.WebAPI.Validators/WIS.WebAPI.Validators.csproj", "src/WIS.WebAPI.Validators/"]
RUN dotnet nuget add source -n wisfeed -u unused -p ${AZURE_DEVOPS_ACCESS_TOKEN} --valid-authentication-types basic --store-password-in-clear-text "https://myFeed/.../nuget/v3/index.json" \
&& dotnet nuget enable source wisfeed
RUN echo ${HTTP_PROXY} - ${AZURE_DEVOPS_ACCESS_TOKEN}
RUN dotnet restore "src/WIS.WebAPI.SharedServices/WIS.WebAPI.SharedServices.csproj"
COPY . .
WORKDIR "/src/src/WIS.WebAPI.SharedServices"
RUN dotnet build "WIS.WebAPI.SharedServices.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "WIS.WebAPI.SharedServices.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WIS.WebAPI.SharedServices.dll"]