Skip to content

Commit

Permalink
add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasisnes committed Nov 29, 2024
1 parent dfee80f commit 6766f4d
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions src/apps/Altinn.AccessManagement/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 6766f4d

Please sign in to comment.