use non-root user in containers

This commit is contained in:
Andy Pack 2023-09-10 19:28:42 +01:00
parent f1df8ae8c5
commit e2291fb90e
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
2 changed files with 10 additions and 0 deletions

View File

@ -19,5 +19,10 @@ FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /app
COPY --from=publish /app ./
ENV DOTNET_EnableDiagnostics=0
ARG DOCKER_USER=selector
RUN addgroup -S $DOCKER_USER && adduser -S $DOCKER_USER -G $DOCKER_USER
USER $DOCKER_USER
ENTRYPOINT ["dotnet", "Selector.CLI.dll"]

View File

@ -30,4 +30,9 @@ EXPOSE 80
WORKDIR /app
COPY --from=publish /app ./
ENV DOTNET_EnableDiagnostics=0
ARG DOCKER_USER=selector
RUN addgroup -S $DOCKER_USER && adduser -S $DOCKER_USER -G $DOCKER_USER
USER $DOCKER_USER
ENTRYPOINT ["dotnet", "Selector.Web.dll"]