From 6766f4dcd09216c3146f4eb6f2946c35e9cc4b39 Mon Sep 17 00:00:00 2001 From: Andreas Isnes Date: Fri, 29 Nov 2024 10:41:04 +0100 Subject: [PATCH] add dockerfile --- src/apps/Altinn.AccessManagement/Dockerfile | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/apps/Altinn.AccessManagement/Dockerfile b/src/apps/Altinn.AccessManagement/Dockerfile index 5d1c310f..8dcf0e95 100644 --- a/src/apps/Altinn.AccessManagement/Dockerfile +++ b/src/apps/Altinn.AccessManagement/Dockerfile @@ -1,23 +1,12 @@ FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build WORKDIR /app +WORKDIR /src +COPY src/ . +WORKDIR /src/apps/Altinn.AccessManagement/src/Altinn.AccessManagement +RUN dotnet publish -c Release -o /app -# Copy everything and build -COPY . . -RUN dotnet restore - -# Copy everything else and build -RUN dotnet publish -c Release -o out ./src/Altinn.AccessManagement/Altinn.AccessManagement.csproj - -# Build runtime image FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine AS final -EXPOSE 5110 WORKDIR /app -COPY --from=build /app/out . +COPY --from=build /app . -# setup the user and group -# the user will have no password, using shell /bin/false and using the group dotnet -RUN addgroup -g 3000 dotnet && adduser -u 1000 -G dotnet -D -s /bin/false dotnet -# update permissions of files if neccessary before becoming dotnet user -USER dotnet -RUN mkdir /tmp/logtelemetry ENTRYPOINT ["dotnet", "Altinn.AccessManagement.dll"]