-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
105 lines (87 loc) · 3.36 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Tutorial
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS tutorial
WORKDIR /samples
COPY ["docs/", "docs/"]
WORKDIR /samples/docs/tutorial
ENV DOTNET_TRY_CLI_TELEMETRY_OPTOUT=1
RUN dotnet tool update -g Microsoft.dotnet-try
ENV PATH="$PATH:/root/.dotnet/tools"
RUN apt-get update
RUN apt-get install -y simpleproxy
RUN echo "simpleproxy -L 50005 -R localhost:50004 -v &" >start.sh
RUN echo "dotnet try --port 50004 /samples/docs/tutorial" >>start.sh
ENTRYPOINT ["sh", "start.sh"]
# Samples
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
RUN apt update \
&& apt install -y --no-install-recommends python3 python3-pip libatomic1 \
&& rm -rf /var/lib/apt/lists/*
RUN dotnet workload install wasm-tools aspire
RUN dotnet dev-certs https
WORKDIR /samples
COPY ["src/", "src/"]
COPY ["docs/", "docs/"]
COPY ["*.props", "."]
COPY Samples.sln .
RUN dotnet build -c:Debug
RUN dotnet build -c:Release --no-restore
# Create HelloWorld sample image
FROM build AS sample_hello_world
WORKDIR /samples/src/HelloWorld
ENTRYPOINT ["dotnet", "bin/Debug/net9.0/Samples.HelloWorld.dll"]
# Create HelloCart sample image
FROM build AS sample_hello_cart
WORKDIR /samples/src/HelloCart
ENTRYPOINT ["dotnet", "bin/Debug/net9.0/Samples.HelloCart.dll"]
# Create HelloBlazorServer sample image
FROM build AS sample_hello_blazor_server
WORKDIR /samples/src/HelloBlazorServer
ENTRYPOINT ["dotnet", "bin/Debug/net9.0/Samples.HelloBlazorServer.dll"]
# Create HelloBlazorHybrid sample image
FROM build AS sample_hello_blazor_hybrid
WORKDIR /samples/src/HelloBlazorHybrid/Server
ENTRYPOINT ["dotnet", "bin/Debug/net9.0/Samples.HelloBlazorHybrid.Server.dll"]
# Create Blazor sample image
FROM build AS sample_blazor
WORKDIR /samples/src/Blazor/Server
ENTRYPOINT ["dotnet", "bin/Debug/net9.0/Samples.Blazor.Server.dll"]
# Create TodoApp sample image
FROM build AS sample_todoapp
WORKDIR /samples/src/TodoApp/Host
ENTRYPOINT ["dotnet", "bin/Debug/net9.0/Samples.TodoApp.Host.dll"]
# Create MiniRpc sample image
FROM build AS sample_mini_rpc
WORKDIR /samples/src/MiniRpc
ENTRYPOINT ["dotnet", "bin/Release/net9.0/Samples.MiniRpc.dll"]
# Create MultiServerRpc sample image
FROM build AS sample_multi_server_rpc
WORKDIR /samples/src/MultiServerRpc
ENTRYPOINT ["dotnet", "bin/Release/net9.0/Samples.MultiServerRpc.dll"]
# Create MeshRpc sample image
FROM build AS sample_mesh_rpc
WORKDIR /samples/src/MeshRpc
ENTRYPOINT ["dotnet", "bin/Release/net9.0/Samples.MeshRpc.dll"]
# Create Benchmark sample image
FROM build AS sample_benchmark
WORKDIR /samples/src/Benchmark
ENV DbHost=host.docker.internal
ENTRYPOINT ["dotnet", "bin/Release/net9.0/Samples.Benchmark.dll"]
# Create RpcBenchmark sample image
FROM build AS sample_rpc_benchmark
WORKDIR /samples/src/RpcBenchmark
ENTRYPOINT ["dotnet", "bin/Release/net9.0/Samples.RpcBenchmark.dll"]
# Websites
FROM build AS publish
WORKDIR /samples
RUN dotnet publish -c:Release --no-build --no-restore src/Blazor/Server/Server.csproj
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
WORKDIR /samples
COPY --from=publish /samples .
# Create Blazor sample image for website
FROM runtime AS sample_blazor_ws
WORKDIR /samples/src/Blazor/Server
ENV Logging__Console__FormatterName=
ENV Server__GitHubClientId=7d519556dd8207a36355
ENV Server__GitHubClientSecret=8e161ca4799b7e76e1c25429728db6b2430f2057
ENTRYPOINT ["dotnet", "bin/Release/net9.0/publish/Samples.Blazor.Server.dll"]