-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathdockerfile.sample.txt
30 lines (22 loc) · 1.6 KB
/
dockerfile.sample.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This sample is for Artifacts Credential Provider version 0.1.28 and it is incompatible with greater versions due to the .NET Core version this sample uses.
# downloading the dotnet sdk image. Could be any docker sdk image with sdk > 2.1.500
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS dotnet-builder
ARG FEED_URL
ARG PAT
# download and install latest credential provider. Not required after https://github.com/dotnet/dotnet-docker/issues/878
RUN wget -qO- https://aka.ms/install-artifacts-credprovider.sh | bash
# Optional
WORKDIR /workdir
COPY ./ .
# 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}\"}]}
# Use this if you have a nuget.config file with all the endpoints.
RUN dotnet restore
# Optional: Extended step to build the app using dotnet msbuild.
RUN dotnet build dirs.proj