From 692f92db8fced4e3b3169d2be76d44fbd460f3b0 Mon Sep 17 00:00:00 2001 From: Omer Levi Hevroni Date: Tue, 19 Jun 2018 20:26:21 +0300 Subject: [PATCH] fix dockerfil --- Dockerfile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0bccd11be..4ae6f860c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,21 @@ FROM microsoft/dotnet:2.0-sdk-stretch AS build-env -RUN useradd -d /home/dotnet -ms /bin/bash dotnet -USER dotnet - -WORKDIR /home/dotnet/app +WORKDIR /app # Copy csproj and restore as distinct layers -COPY ./src/Hamuste.csproj ./ +COPY ./src/Hamuste.csproj ./ RUN dotnet add package ILLink.Tasks -v 0.1.4-preview-981901 -s https://dotnet.myget.org/F/dotnet-core/api/v3/index.json &&\ dotnet restore # Copy everything else and build -COPY ./src ./ +COPY ./src ./ RUN dotnet publish -c Release -o out -r linux-x64 # Build runtime image FROM microsoft/dotnet:2.0-runtime-deps -RUN useradd -d /home/dotnet -ms /bin/bash dotnet +RUN groupadd -r dotnet && useradd --no-log-init -r -g dotnet -d /home/dotnet -ms /bin/bash dotnet USER dotnet WORKDIR /home/dotnet/app ENV ASPNETCORE_URLS=http://+:9999 -COPY --from=build-env /home/dotnet/app/out ./ +COPY --chown=dotnet:dotnet --from=build-env /app/out ./ ENTRYPOINT ["./Hamuste"] \ No newline at end of file