Skip to content

Commit

Permalink
build image also as unprivileged user
Browse files Browse the repository at this point in the history
  • Loading branch information
omerlh committed Jun 19, 2018
1 parent f6c5fad commit 68a830c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
FROM microsoft/dotnet:2.0-sdk-stretch AS build-env
WORKDIR /app

RUN useradd -d /home/dotnet -ms /bin/bash dotnet
USER dotnet

WORKDIR /home/dotnet/app

# Copy csproj and restore as distinct layers
COPY ./src/Hamuste.csproj ./
RUN dotnet restore && \
dotnet add package ILLink.Tasks -v 0.1.4-preview-981901 -s https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
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 ./
Expand All @@ -16,5 +20,5 @@ RUN useradd -d /home/dotnet -ms /bin/bash dotnet
USER dotnet
WORKDIR /home/dotnet/app
ENV ASPNETCORE_URLS=http://+:9999
COPY --from=build-env /app/out ./
COPY --from=build-env /home/dotnet/app/out ./
ENTRYPOINT ["./Hamuste"]

0 comments on commit 68a830c

Please sign in to comment.