-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (23 loc) · 1.02 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM mcr.microsoft.com/dotnet/sdk:8.0.301-alpine3.18 AS build
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY src/Altinn.Broker.API/*.csproj ./src/Altinn.Broker.API/
COPY src/Altinn.Broker.Core/*.csproj ./src/Altinn.Broker.Core/
COPY src/Altinn.Broker.Integrations/*.csproj ./src/Altinn.Broker.Integrations/
COPY src/Altinn.Broker.Persistence/*.csproj ./src/Altinn.Broker.Persistence/
RUN dotnet restore ./src/Altinn.Broker.API/Altinn.Broker.API.csproj
# Copy everything else and build
COPY src ./src
RUN dotnet publish -c Release -o out ./src/Altinn.Broker.API/Altinn.Broker.API.csproj
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0.6-alpine3.18 AS final
WORKDIR /app
EXPOSE 2525
ENV ASPNETCORE_URLS=http://+:2525
COPY --from=build /app/out .
#COPY src/Altinn.Broker.Persistence/Migration ./Migration
RUN addgroup -g 3000 dotnet && adduser -u 1000 -G dotnet -D -s /bin/false dotnet
RUN mkdir -p /mnt/storage
run chown -R dotnet:dotnet /mnt/storage
USER dotnet
ENTRYPOINT [ "dotnet", "Altinn.Broker.API.dll" ]