diff --git a/src/aka.terribledev.io/Dockerfile b/src/aka.terribledev.io/Dockerfile index 1198d5b..7b0e939 100644 --- a/src/aka.terribledev.io/Dockerfile +++ b/src/aka.terribledev.io/Dockerfile @@ -1,16 +1,16 @@ -FROM microsoft/dotnet:2.1.400-sdk-alpine3.7 - -COPY . /app - +FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /app -RUN ["dotnet", "restore"] +# copy csproj and restore as distinct layers +COPY aka.terribledev.io.csproj . +RUN dotnet restore -RUN ["dotnet", "build", "--configuration", "Release"] +# copy everything else and build app +COPY . . +RUN dotnet publish -c Release -o out -RUN 'ls' -ENV ASPNETCORE_ENVIRONMENT Production -ENV ASPNETCORE_URLS http://*:5000 -EXPOSE 5000/tcp -CMD ["dotnet", "run", "--configuration", "Release"] +FROM microsoft/dotnet:2.1-aspnetcore-runtime AS runtime +WORKDIR /app +COPY --from=build /app/out ./ +ENTRYPOINT ["dotnet", "aka.terribledev.io.dll"] \ No newline at end of file