45 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
 | |
| ARG BuildVersion
 | |
| ARG PACKAGETEST_FEED_URL
 | |
| ARG READ_NUGET_PAT
 | |
| ARG READ_NUGET_USER
 | |
| ARG BuildUniqueID
 | |
| LABEL build.uniqueid="${BuildUniqueID:-1}"
 | |
| RUN wget -qO- https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
 | |
| # Optional: Sometimes the http client hangs because of a .NEt issue. Setting this in dockerfile helps 
 | |
| ENV DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
 | |
| # Environment variable to enable seesion token cache. More on this here: https://github.com/Microsoft/artifacts-credprovider#help
 | |
| ENV NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED true
 | |
| 
 | |
| # Environment variable for adding endpoint credentials. More on this here: https://github.com/Microsoft/artifacts-credprovider#help
 | |
| # Add "FEED_URL" AND "PAT" using --build-arg in docker build step. "endpointCredentials" field is an array, you can add multiple endpoint configurations.
 | |
| # Make sure that you *do not* hard code the "PAT" here. That is a sensitive information and must not be checked in.
 | |
| # ENV VSS_NUGET_EXTERNAL_FEED_ENDPOINTS {\"endpointCredentials\": [{\"endpoint\":\"${FEED_URL}\", \"username\":\"ArtifactsDocker\", \"password\":\"${PAT}\"}, {\"endpoint\":\"${GITHUB_FEED_URL}\", \"username\":\"${GITHUB_USER}\", \"password\":\"${GITHUB_PAT}\"}]}
 | |
| # RUN dotnet nuget add source ${FEED_URL} --name "myfeed" --username "whatever" --password="${PAT}" --store-password-in-clear-text --valid-authentication-types "basic"
 | |
| RUN dotnet nuget add source ${PACKAGETEST_FEED_URL} --name "myfeed_gitea" --username "${READ_NUGET_USER}}" --password="${READ_NUGET_PAT}}" --store-password-in-clear-text --valid-authentication-types "basic"
 | |
| 
 | |
| WORKDIR /src
 | |
| COPY . .
 | |
| RUN dotnet restore "SimplePackage/SimplePackage.csproj" --runtime linux-x64
 | |
| WORKDIR "/SimplePackage"
 | |
| RUN dotnet build "SimplePackage.csproj" --no-restore -c Release -o /app /property:Version=${BuildVersion:-1.0.0-dev} --self-contained --runtime linux-x64
 | |
| 
 | |
| FROM build AS publish
 | |
| ENV TZ=Europe/Berlin
 | |
| ENV LANG de_DE.UTF-8
 | |
| ENV LANGUAGE de_DE:de
 | |
| ENV LC_ALL de_DE.UTF-8
 | |
| ARG BuildVersion
 | |
| RUN dotnet publish "SimplePackage.csproj" --no-restore -c Release -o /app /property:Version=${BuildVersion:-1.0.0-dev} --self-contained --runtime linux-x64
 | |
| 
 | |
| FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-jammy-chiseled-extra AS final
 | |
| ENV TZ=Europe/Berlin
 | |
| ENV LANG de_DE.UTF-8
 | |
| ENV LANGUAGE de_DE:de
 | |
| ENV LC_ALL de_DE.UTF-8
 | |
| ENV ASPNETCORE_HTTP_PORTS=8080
 | |
| ENV ASPNETCORE_URLS=http://*:8080
 | |
| EXPOSE 8080
 | |
| WORKDIR /app
 | |
| COPY --from=publish /app .
 | |
| ENTRYPOINT ["./SimplePackage"] |