-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (26 loc) · 1.23 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
30
31
32
33
34
FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy AS build
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.sln .
COPY src/WebApi/Denex.WebApi/Denex.WebApi.csproj ./src/WebApi/Denex.WebApi/
COPY src/Core/Denex.Domain/Denex.Domain.csproj ./src/Core/Denex.Domain/
COPY src/Core/Denex.Application/Denex.Application.csproj ./src/Core/Denex.Application/
COPY src/Infrastructure/Denex.Persistance/Denex.Persistance.csproj ./src/Infrastructure/Denex.Persistance/
COPY tests/WebApi.UnitTest/WebApi.UnitTest.csproj ./tests/WebApi.UnitTest/
RUN dotnet restore
# copy everything else and build app
COPY src/WebApi/Denex.WebApi/. ./src/WebApi/Denex.WebApi/
COPY src/Core/Denex.Domain/. ./src/Core/Denex.Domain/
COPY src/Core/Denex.Application/. ./src/Core/Denex.Application/
COPY src/Infrastructure/Denex.Persistance/. ./src/Infrastructure/Denex.Persistance/
COPY tests/WebApi.UnitTest/. ./tests/WebApi.UnitTest/
WORKDIR /app/src/WebApi/Denex.WebApi
RUN dotnet publish -c Release -o out
WORKDIR /app/tests/WebApi.UnitTest
RUN dotnet test --verbosity quiet
# build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0-jammy AS runtime
WORKDIR /app
COPY --from=build /app/src/WebApi/Denex.WebApi/out ./
EXPOSE 80
ENTRYPOINT ["dotnet", "Denex.WebApi.dll"]