This repository has been archived on 2023-10-28. You can view files and clone it, but cannot push or open issues or pull requests.
pwt-0x01-ng/Dockerfile
surtur 4fd4146b1d
All checks were successful
continuous-integration/drone/push Build is passing
feat: unprivileged prod container w/ nobody+alpine
* 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
2021-02-23 15:19:16 +01:00

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"]