Skip to content

Commit a9e1f08

Browse files
committed
optimized Dependency build
1 parent 7bc7bac commit a9e1f08

File tree

4 files changed

+38
-25
lines changed

4 files changed

+38
-25
lines changed

Dependencies/Dockerfile

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,46 @@
1-
FROM alpine/git AS retriver
1+
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS deps-build
2+
WORKDIR /app/Dependencies
3+
COPY ./Dependencies ./
4+
RUN dotnet build
5+
RUN rm ./bin/Debug/netstandard2.1/System.Runtime.InteropServices.WindowsRuntime.dll
6+
7+
8+
FROM alpine/git AS rx-retriver
29
WORKDIR /app
310
RUN git clone --branch rxnet-v5.0.0 --depth 1 https://github.com/dotnet/reactive.git
4-
RUN git clone --branch v1.0.2 --depth 1 https://github.com/Cosmic-Shores/Rx.Data.git
511
RUN cp ./reactive/Rx.NET/Source/Directory.build.props ./reactive/Rx.NET/Source/src/System.Reactive/Directory.build.props
6-
COPY ./Patches/Directory.build.props ./Rx.Data/src/Directory.build.props
7-
COPY ./Patches/SchedulerDefaults.cs ./reactive/Rx.NET/Source/src/System.Reactive/Concurrency/SchedulerDefaults.cs
8-
COPY ./Patches/InternalsVisibleTo.cs ./reactive/Rx.NET/Source/src/System.Reactive/Properties/InternalsVisibleTo.cs
9-
COPY ./Patches/global.json ./reactive/Rx.NET/Source/src/global.json
1012

11-
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
13+
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS rx-build
1214
WORKDIR /app
13-
COPY --from=retriver /app ./
15+
COPY --from=rx-retriver /app ./
1416
COPY ./Patcher ./Patcher/
15-
COPY ./Dependencies ./Dependencies/
16-
17-
WORKDIR /app/Dependencies
18-
RUN dotnet build
19-
RUN rm ./bin/Debug/netstandard2.1/System.Runtime.InteropServices.WindowsRuntime.dll
2017

2118
WORKDIR /app/Patcher
2219
RUN dotnet run
2320

21+
WORKDIR /app
22+
COPY ./Patches/SchedulerDefaults.cs ./reactive/Rx.NET/Source/src/System.Reactive/Concurrency/SchedulerDefaults.cs
23+
COPY ./Patches/InternalsVisibleTo.cs ./reactive/Rx.NET/Source/src/System.Reactive/Properties/InternalsVisibleTo.cs
24+
COPY ./Patches/global.json ./reactive/Rx.NET/Source/src/global.json
25+
2426
WORKDIR /app/reactive/Rx.NET/Source/src/System.Reactive
2527
RUN dotnet build
2628

29+
30+
FROM alpine/git AS rxdata-retriver
31+
WORKDIR /app
32+
RUN git clone --branch main --depth 1 https://github.com/Cosmic-Shores/Rx.Data.git
33+
34+
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS rxdata-build
2735
WORKDIR /app/Rx.Data
36+
COPY --from=rx-build /app/reactive/Rx.NET/Source/src/System.Reactive/bin/Debug/netstandard2.0 ./src/
37+
COPY --from=rxdata-retriver /app ../
38+
COPY ./Patches/Directory.build.props ./src/Directory.build.props
2839
RUN dotnet build
2940

41+
3042
FROM scratch AS export-stage
31-
COPY --from=build-env /app/Dependencies/bin/Debug/netstandard2.1 ./
32-
COPY --from=build-env /app/reactive/Rx.NET/Source/src/System.Reactive/bin/Debug/netstandard2.0 ./
33-
COPY --from=build-env /app/Rx.Data/src/Rx.Extendibility/bin/Debug/netstandard2.0 ./
34-
COPY --from=build-env /app/Rx.Data/src/Rx.Data/bin/Debug/netstandard2.0 ./
43+
COPY --from=deps-build /app/Dependencies/bin/Debug/netstandard2.1 ./
44+
COPY --from=rx-build /app/reactive/Rx.NET/Source/src/System.Reactive/bin/Debug/netstandard2.0 ./
45+
COPY --from=rxdata-build /app/Rx.Data/src/Rx.Extendibility/bin/Debug/netstandard2.0 ./
46+
COPY --from=rxdata-build /app/Rx.Data/src/Rx.Data/bin/Debug/netstandard2.0 ./
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<Project>
2+
<Import Project=".\References.build.props" />
23
<PropertyGroup>
34
<GenerateDocumentationFile>true</GenerateDocumentationFile>
45
<DefaultLanguage>en-US</DefaultLanguage>
@@ -8,11 +9,4 @@
89
<PackageProjectUrl>https://github.com/Cosmic-Shores/Rx.Data</PackageProjectUrl>
910
<RepositoryUrl>https://github.com/Cosmic-Shores/Rx.Data</RepositoryUrl>
1011
</PropertyGroup>
11-
12-
<ItemGroup>
13-
<Reference Include="System.Reactive">
14-
<HintPath>..\..\reactive\Rx.NET\Source\src\System.Reactive\bin\Debug\netstandard2.0\System.Reactive.dll</HintPath>
15-
</Reference>
16-
</ItemGroup>
17-
1812
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project>
2+
<ItemGroup>
3+
<Reference Include="System.Reactive">
4+
<HintPath>..\System.Reactive.dll</HintPath>
5+
</Reference>
6+
</ItemGroup>
7+
</Project>

build-dependencies.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
cd ./Dependencies
2-
docker build --output out .
2+
docker build --output out . --no-cache

0 commit comments

Comments
 (0)