forked from wanderer/pwt-0x01-ng
* let restore run as root in base container * switch runtime container to alpine (was using debian before) * chown stuff as nobody:nobody and become nobody to run the app * as a consequence, we're no longer allowed to bind to :80 so the port has been changed to :8081. that also needed to be reflected in the compose file for traefik to know where to route traffic * ASPNETCORE_ENVIRONMENT env var properly set to Production
18 lines
410 B
Docker
18 lines
410 B
Docker
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS base
|
|
WORKDIR /src
|
|
|
|
COPY *.csproj ./
|
|
RUN dotnet restore
|
|
|
|
COPY . ./
|
|
RUN dotnet publish -c Release -o bin/out
|
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:3.1-alpine
|
|
WORKDIR /App
|
|
COPY --from=base /src/bin/out/ .
|
|
RUN chown -R nobody:nobody ./
|
|
USER nobody
|
|
ENV ASPNETCORE_ENVIRONMENT Production
|
|
ENV ASPNETCORE_URLS http://*:8081
|
|
ENTRYPOINT ["dotnet", "pwt-0x01-ng.dll"]
|