From e0bc6f57cb4b99f9a67354847dea46503d7ea069 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sun, 28 Apr 2019 16:18:49 -0500 Subject: [PATCH] optimize api dockerfile --- src/FilterLists.Api/Dockerfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/FilterLists.Api/Dockerfile b/src/FilterLists.Api/Dockerfile index 56e508765..e7570e450 100644 --- a/src/FilterLists.Api/Dockerfile +++ b/src/FilterLists.Api/Dockerfile @@ -1,6 +1,14 @@ # Context: . # Command: docker build -f src/FilterLists.Api/Dockerfile . +# prep runtime +FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine as runtime +ENTRYPOINT ["dotnet", "FilterLists.Api.dll"] +ENV DataDirectory__Path "data" +ENV ASPNETCORE_URLS "http://*:5000" +EXPOSE 5000 + +# init build FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine AS build # restore @@ -38,10 +46,6 @@ RUN dotnet build -c Release --no-restore ENTRYPOINT ["dotnet", "test"] # run -FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine as runtime -ENTRYPOINT ["dotnet", "FilterLists.Api.dll"] -ENV DataDirectory__Path "data" -ENV ASPNETCORE_URLS "http://*:5000" -EXPOSE 5000 +FROM runtime COPY --from=build /src/FilterLists.Api/out ./ COPY data/. ./data/