-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (21 loc) · 856 Bytes
/
Copy pathDockerfile
File metadata and controls
26 lines (21 loc) · 856 Bytes
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
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG TARGETARCH
WORKDIR /src
COPY Reported.sln ./
COPY Reported/Reported.csproj Reported/
COPY Reported.Persistence/Reported.Persistence.csproj Reported.Persistence/
COPY Reported.Tests/Reported.Tests.csproj Reported.Tests/
RUN dotnet restore -a $TARGETARCH
COPY . .
FROM build AS test
RUN dotnet test --configuration Release --no-restore --verbosity normal
FROM test AS publish
RUN dotnet publish Reported/Reported.csproj -a $TARGETARCH -c Release -o /app/publish --no-restore
FROM mcr.microsoft.com/dotnet/runtime:10.0 AS final
RUN groupadd -r reported && useradd -r -g reported reported
RUN mkdir -p /data && chown reported:reported /data
WORKDIR /app
COPY --from=publish /app/publish .
USER reported
ENV DATABASE_PATH=/data/reported.db
ENTRYPOINT ["dotnet", "Reported.dll"]