Skip to content

Instantly share code, notes, and snippets.

@PawelHaracz
Created December 27, 2018 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PawelHaracz/d78b00979c1854b4f6458adbfa0870a4 to your computer and use it in GitHub Desktop.
Save PawelHaracz/d78b00979c1854b4f6458adbfa0870a4 to your computer and use it in GitHub Desktop.
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /app
EXPOSE 80
# copy csproj and restore as distinct layers
COPY src/nuget.config ./src/
COPY src/*.sln ./src/
COPY src/Qbank.Questions/*.csproj ./src/Qbank.Questions/
COPY src/Qbank.Questions.WebApi/*.csproj ./src/Qbank.Questions.WebApi/
COPY test/Qbank.Questions.Test/*.csproj ./test/Qbank.Questions.Test/
RUN dotnet restore ./src/ --configfile ./src/nuget.config
# copy everything else and build app
COPY src/Qbank.Questions/. ./src/Qbank.Questions/
COPY src/Qbank.Questions.WebApi/. ./src/Qbank.Questions.WebApi/
COPY test/Qbank.Questions.Test/. ./test/Qbank.Questions.Test/
ENV VaultUrl=Default-keyVault
ENV ClientId=DefaultClientId
ENV ClientSecret=DefaultSecret
WORKDIR /app/src/Qbank.Questions.WebApi/
RUN dotnet publish -c Release -o out
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS runtime
WORKDIR /app
COPY --from=build /app/src/Qbank.Questions.WebApi/out ./
ENTRYPOINT ["dotnet", "Qbank.Questions.WebApi.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment