-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (25 loc) · 1 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
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# Add curl to template.
# CDP PLATFORM HEALTHCHECK REQUIREMENT
RUN apt update && \
apt install curl -y
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build
WORKDIR /src
COPY . .
WORKDIR "/src/Defra.Cdp.Backend.Api"
FROM build AS publish
RUN dotnet publish "Defra.Cdp.Backend.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false
# unit test and code coverage
# use the label to identity this layer later
LABEL test=true
#RUN dotnet test -c Release --collect:"XPlat Code Coverage" --results-directory /app/testresults "../Defra.Cdp.Backend.Api.UnitTests/Defra.Cdp.Backend.Api.UnitTests.csproj"
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
EXPOSE 8085
ENTRYPOINT ["dotnet", "Defra.Cdp.Backend.Api.dll"]