-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (39 loc) · 1.75 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (39 loc) · 1.75 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
# Base dotnet image
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# Add curl to template.
# CDP PLATFORM HEALTHCHECK REQUIREMENT
RUN apt update && \
apt install curl -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Build stage image
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
ARG TARGETARCH=x64
ENV BUILD_CONFIGURATION=${BUILD_CONFIGURATION}
WORKDIR /src
COPY ["src/KeeperData.Api/KeeperData.Api.csproj", "KeeperData.Api/"]
COPY ["src/KeeperData.Api.Worker/KeeperData.Api.Worker.csproj", "KeeperData.Api.Worker/"]
COPY ["src/KeeperData.Infrastructure/KeeperData.Infrastructure.csproj", "KeeperData.Infrastructure/"]
COPY ["src/KeeperData.Application/KeeperData.Application.csproj", "KeeperData.Application/"]
COPY ["src/KeeperData.Core/KeeperData.Core.csproj", "KeeperData.Core/"]
RUN dotnet restore "KeeperData.Api/KeeperData.Api.csproj" -r linux-${TARGETARCH} -v n
RUN dotnet restore "KeeperData.Api.Worker/KeeperData.Api.Worker.csproj" -r linux-${TARGETARCH} -v n
RUN dotnet restore "KeeperData.Infrastructure/KeeperData.Infrastructure.csproj" -r linux-${TARGETARCH} -v n
RUN dotnet restore "KeeperData.Application/KeeperData.Application.csproj" -r linux-${TARGETARCH} -v n
RUN dotnet restore "KeeperData.Core/KeeperData.Core.csproj" -r linux-${TARGETARCH} -v n
COPY ["src/", "."]
FROM build AS publish
ARG TARGETARCH=x64
WORKDIR "/src/KeeperData.Api"
RUN dotnet publish "KeeperData.Api.csproj" -v n -c ${BUILD_CONFIGURATION} -o /app/publish -r linux-${TARGETARCH} --no-restore /p:UseAppHost=false
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
# Final production image
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
EXPOSE 8085
ENTRYPOINT ["dotnet", "KeeperData.Api.dll"]