-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (42 loc) · 2.13 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime
WORKDIR /app
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS aspnet
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS cli-build
WORKDIR /src/
COPY ["src/global.json", "."]
COPY ["src/StarWarsData.Models/StarWarsData.Models.csproj", "StarWarsData.Models/"]
RUN dotnet restore "StarWarsData.Models/StarWarsData.Models.csproj"
COPY ["src/StarWarsData.Services/StarWarsData.Services.csproj", "StarWarsData.Services/"]
RUN dotnet restore "StarWarsData.Services/StarWarsData.Services.csproj"
COPY ["src/StarWarsData.CLI/StarWarsData.CLI.csproj", "StarWarsData.CLI/"]
RUN dotnet restore "StarWarsData.CLI/StarWarsData.CLI.csproj"
COPY ["src/", "."]
RUN dotnet build StarWarsData.CLI/StarWarsData.CLI.csproj -c Release -o /app/build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS web-build
WORKDIR /src/
COPY ["src/global.json", "."]
COPY ["src/StarWarsData.Models/StarWarsData.Models.csproj", "StarWarsData.Models/"]
RUN dotnet restore "StarWarsData.Models/StarWarsData.Models.csproj"
COPY ["src/StarWarsData.Services/StarWarsData.Services.csproj", "StarWarsData.Services/"]
RUN dotnet restore "StarWarsData.Services/StarWarsData.Services.csproj"
COPY ["src/StarWarsData.Server/StarWarsData.Server.csproj", "StarWarsData.Server/"]
RUN dotnet restore "StarWarsData.Server/StarWarsData.Server.csproj"
COPY ["src/StarWarsData.Client/StarWarsData.Client.csproj", "StarWarsData.Client/"]
RUN dotnet workload restore "StarWarsData.Client/StarWarsData.Client.csproj"
RUN dotnet restore "StarWarsData.Client/StarWarsData.Client.csproj"
COPY ["src/", "."]
RUN dotnet build StarWarsData.Server/StarWarsData.Server.csproj -c Release -o /app/build
FROM cli-build AS cli-publish
RUN dotnet publish StarWarsData.CLI/StarWarsData.CLI.csproj -c Release -o /app/publish
FROM web-build as web-publish
RUN dotnet publish StarWarsData.Server/StarWarsData.Server.csproj -c Release -o /app/publish
FROM runtime AS cli
WORKDIR /app
RUN mkdir /data
COPY --from=cli-publish /app/publish .
ENTRYPOINT ["dotnet", "StarWarsData.CLI.dll"]
FROM aspnet AS web
WORKDIR /app
COPY --from=web-publish /app/publish .
ENTRYPOINT ["dotnet", "StarWarsData.Server.dll"]