1
- FROM mcr.microsoft.com/dotnet/sdk :5.0-focal
1
+ FROM mcr.microsoft.com/dotnet/aspnet :5.0-focal as builder
2
2
3
3
ENV DEBIAN_FRONTEND=noninteractive
4
4
ENV OPENCV_VERSION=4.5.3
@@ -97,12 +97,19 @@ RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \
97
97
make -j$(nproc) && make install && \
98
98
rm -rf /opencv && \
99
99
rm -rf /opencv_contrib && \
100
- mkdir /artifacts && \
101
- cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /artifacts/
100
+ cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/
101
+
102
102
103
- # Test OpenCvSharpExtern
104
- RUN cp artifacts/libOpenCvSharpExtern.so /usr/lib/ && \
105
- echo "\n \
103
+ # ######### Test native .so file ##########
104
+
105
+ FROM mcr.microsoft.com/dotnet/sdk:5.0-focal
106
+ RUN apt-get update && apt-get -y install --no-install-recommends gcc
107
+ # /usr/lib/libOpenCvSharpExtern.so
108
+ # /usr/local/lib/libopencv_*.a
109
+ COPY --from=builder /usr/lib /usr/lib
110
+ # COPY --from=builder /usr/local/lib /usr/local/lib
111
+
112
+ RUN echo "\n \
106
113
#include <stdio.h> \n \
107
114
int core_Mat_sizeof(); \n \
108
115
int main(){ \n \
@@ -111,24 +118,21 @@ int main(){ \n\
111
118
return 0; \n \
112
119
}" > /test.c && \
113
120
gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern && \
114
- LD_LIBRARY_PATH=. ./test && \
115
- rm -f /test*
121
+ LD_LIBRARY_PATH=. ./test
116
122
117
- # Install Build the C# part of OpenCvSharp
118
- # RUN cd /opencvsharp/src/OpenCvSharp && \
119
- # dotnet build -c Release -f netstandard2.1 && \
120
- # cd /opencvsharp/src/OpenCvSharp.Blob && \
121
- # dotnet build -c Release -f netstandard2.1 && \
122
- # cd /opencvsharp/src/OpenCvSharp.Extensions && \
123
- # dotnet build -c Release -f netstandard2.1 && \
124
- # cp /opencvsharp/src/OpenCvSharp/bin/Release/netstandard2.1/* /artifacts/ && \
125
- # cp /opencvsharp/src/OpenCvSharp.Blob/bin/Release/netstandard2.1/* /artifacts/ && \
126
- # cp /opencvsharp/src/OpenCvSharp.Extensions/bin/Release/netstandard2.1/* /artifacts/
127
123
128
- # Test OpenCvSharp
129
- # RUN dotnet test /opencvsharp/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj -c Release -f netcoreapp3.1 --runtime ubuntu.18.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null
124
+ # ######### Test .NET class libraries ##########
125
+
126
+ FROM mcr.microsoft.com/dotnet/sdk:5.0-focal
127
+ COPY --from=builder /usr/lib /usr/lib
128
+ # Install Build the C# part of OpenCvSharp
129
+ RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp
130
+ RUN cd /opencvsharp/src/OpenCvSharp && \
131
+ dotnet build -c Release -f netcoreapp3.1 && \
132
+ cd /opencvsharp/src/OpenCvSharp.Extensions && \
133
+ dotnet build -c Release -f netcoreapp2.1
130
134
131
- RUN rm -rf /opencvsharp
135
+ RUN dotnet test /opencvsharp/test/OpenCvSharp.Tests/OpenCvSharp.Tests.csproj -c Release -f net5.0 --runtime ubuntu.20.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null
132
136
133
137
# Simple console app test using NuGet
134
138
# RUN dotnet new console -f netcoreapp3.1 -o "ConsoleApp01" && cd /ConsoleApp01 && \
@@ -147,3 +151,10 @@ RUN rm -rf /opencvsharp
147
151
# rm -rf /ConsoleApp01
148
152
149
153
# RUN ldd /artifacts/libOpenCvSharpExtern.so
154
+
155
+
156
+
157
+ # ######### Final image ##########
158
+
159
+ FROM mcr.microsoft.com/dotnet/sdk:5.0-focal as final
160
+ COPY --from=builder /usr/lib /usr/lib
0 commit comments