Created
August 16, 2018 22:07
-
-
Save karlospn/c009b57e07204a4594d5dbb31120d82b to your computer and use it in GitHub Desktop.
Dockerfile net core 2.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------------------------------------- | |
Dockerfile | |
----------------------------------------------- | |
FROM microsoft/dotnet:2.1.300-sdk AS build-env | |
WORKDIR /app | |
# Copy csproj and restore as distinct layers | |
COPY *.sln ./ | |
COPY /src/VY.AMS.Resources.WebApi/*.csproj ./src/VY.AMS.Resources.WebApi/ | |
COPY /src/VY.AMS.Resources.Business.Contracts/*.csproj ./src/VY.AMS.Resources.Business.Contracts/ | |
COPY /src/VY.AMS.Resources.Business.Impl/*.csproj ./src/VY.AMS.Resources.Business.Impl/ | |
COPY /src/VY.AMS.Resources.DomainContracts/*.csproj ./src/VY.AMS.Resources.DomainContracts/ | |
COPY /src/VY.AMS.Resources.Infra.Contracts/*.csproj ./src/VY.AMS.Resources.Infra.Contracts/ | |
COPY /src/VY.AMS.Resources.Infra.Impl/*.csproj ./src/VY.AMS.Resources.Infra.Impl/ | |
COPY NuGet.Config ./ | |
RUN dotnet restore --configfile NuGet.Config -nowarn:msb3202,nu1503 | |
# Copy everything else and build | |
COPY . ./ | |
RUN dotnet publish src/VY.AMS.Resources.WebApi/*.csproj -c Release -o out | |
# Build runtime image | |
FROM microsoft/dotnet:2.1.0-runtime | |
WORKDIR /app | |
COPY --from=build-env /app/src/VY.AMS.Resources.WebApi/out . | |
ENTRYPOINT ["dotnet", "VY.AMS.Resources.WebApi.dll"] | |
------------------------------------------ | |
Nuget.Config | |
------------------------------------------ | |
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<packageSources> | |
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | |
<add key="AMS" value="AMS FEED HERE" /> | |
</packageSources> | |
<packageSourceCredentials> | |
<AMS> | |
<add key="Username" value="RANDOM STRING HERE" /> | |
<add key="ClearTextPassword" value="PAT HERE" /> | |
</AMS> | |
</packageSourceCredentials> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment