-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.r4rank.amd64
executable file
·174 lines (154 loc) · 6.6 KB
/
Dockerfile.r4rank.amd64
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
FROM ubuntu:jammy as builder
RUN mkdir -p /opt/rss-termius-v2-rank && \
mkdir -p /opt/xgboost && \
mkdir -p /opt/rank_model/
RUN apt-get update && \
apt-get install build-essential -y && \
apt-get install cmake -y && \
apt-get install libgflags-dev -y && \
apt install git -y && \
apt install curl -y && \
apt install pkg-config -y && \
apt-get install libssl-dev -y && \
apt-get install libcpprest-dev -y && \
cd /opt/xgboost && \
git clone --recursive https://github.com/dmlc/xgboost . && \
git checkout -b release_2.0.0 origin/release_2.0.0 && \
git submodule init && \
git submodule update && \
mkdir build && \
cd build && \
cmake .. -DBUILD_STATIC_LIB=on && \
make -j$(nproc) && \
make install && \
cd /opt && \
rm -r xgboost
RUN cd /opt && \
curl -LJO https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz && \
tar -xvzf googletest-1.14.0.tar.gz && \
cd /opt/googletest-1.14.0 && \
mkdir build && \
cd build && \
cmake .. && \
make -j$(nproc) && \
make install && \
cd /opt && \
rm -r googletest-1.14.0 && \
rm googletest-1.14.0.tar.gz
RUN cd /opt && \
curl -LJO https://github.com/mongodb/mongo-c-driver/releases/download/1.24.0/mongo-c-driver-1.24.0.tar.gz && \
tar -xvzf mongo-c-driver-1.24.0.tar.gz && \
cd mongo-c-driver-1.24.0/build && \
cmake .. && \
make -j$(nproc) && \
make install && \
cd /opt && \
rm mongo-c-driver-1.24.0.tar.gz && \
rm -r mongo-c-driver-1.24.0
RUN cd /opt && \
curl -LJO https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.8.1/mongo-cxx-driver-r3.8.1.tar.gz && \
tar -xvzf mongo-cxx-driver-r3.8.1.tar.gz && \
cd mongo-cxx-driver-r3.8.1/build && \
cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
make -j$(nproc) && \
make install && \
cd /opt && \
rm mongo-cxx-driver-r3.8.1.tar.gz && \
rm -r mongo-cxx-driver-r3.8.1
RUN cd /opt && \
curl -LO https://github.com/google/sentencepiece/archive/refs/tags/v0.1.99.tar.gz && \
tar -xvzf v0.1.99.tar.gz && \
cd sentencepiece-0.1.99 && \
mkdir build && \
cd build && \
cmake .. && \
make -j$(nproc) && \
make install && \
cd /opt && \
rm -r sentencepiece-0.1.99 && \
rm v0.1.99.tar.gz
RUN cd /opt && \
mkdir -p /usr/local/include/cppitertools && \
curl -LO https://github.com/ryanhaining/cppitertools/archive/refs/tags/v2.1.tar.gz && \
tar xzvf v2.1.tar.gz && \
cd cppitertools-2.1/ && \
cp *.hpp /usr/local/include/cppitertools && \
cp -r internal /usr/local/include/cppitertools && \
cd /opt && \
rm v2.1.tar.gz && \
rm -r cppitertools-2.1
ENV EIGEN3_INCLUDE_DIR=/usr/local/include/eigen3
RUN cd /opt && \
curl -LJO https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz \
&& tar -xzf eigen-3.4.0.tar.gz \
&& cd eigen-3.4.0 && \
mkdir build && \
cd build && \
cmake .. && \
make install
RUN cd /opt && \
curl -LJO https://github.com/OpenMathLib/OpenBLAS/archive/refs/tags/v0.3.28.tar.gz && \
tar -xvzf OpenBLAS-0.3.28.tar.gz && \
cd OpenBLAS-0.3.28 && \
make -j$(nproc) && \
make PREFIX=/usr/local install
RUN cd /opt && \
apt-get install -y gfortran && \
curl -LJO https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.12.0.tar.gz && \
tar -xvzf lapack-3.12.0.tar.gz && \
cd lapack-3.12.0 && \
mkdir build && \
cd build && \
cmake .. && \
make blas lapack && \
make install
RUN apt install wget -y && \
wget https://cmake.org/files/v3.25/cmake-3.25.2-linux-x86_64.sh && \
bash cmake-3.25.2-linux-x86_64.sh --prefix=/usr/local --skip-license
RUN cd /opt && \
curl -LJO https://codeload.github.com/facebookresearch/faiss/tar.gz/refs/tags/v1.9.0 && \
tar -xvzf faiss-1.9.0.tar.gz && \
cd faiss-1.9.0 && \
mkdir build && \
cd build && \
cmake .. -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON && \
make -j$(nproc) && \
make install
ADD train-rank/src /opt/rss-terminus-v2-rank/src
ADD train-rank/test /opt/rss-terminus-v2-rank/test
COPY train-rank/CMakeLists.txt /opt/rss-terminus-v2-rank/CMakeLists.txt
COPY train-rank/*.cmake /opt/rss-terminus-v2-rank/
RUN cd /opt/rss-terminus-v2-rank && \
mkdir build && \
cd build && \
cmake .. && \
make && \
cp bertv2rank /usr/local/bin && \
cd /opt && \
rm -r rss-termius-v2-rank
FROM ubuntu:jammy
# FROM alpine
COPY --from=builder /usr/local/bin/bertv2rank /usr/local/bin/bertv2rank
COPY --from=builder /usr/local/lib/libmongocxx.so._noabi /usr/local/lib/libmongocxx.so._noabi
COPY --from=builder /usr/local/lib/libbsoncxx.so._noabi /usr/local/lib/libbsoncxx.so._noabi
COPY --from=builder /usr/local/lib/libmongoc-1.0.so.0 /usr/local/lib/libmongoc-1.0.so.0
COPY --from=builder /usr/local/lib/libbson-1.0.so.0 /usr/local/lib/libbson-1.0.so.0
COPY --from=builder /usr/lib/x86_64-linux-gnu/libgomp.so.1 /usr/lib/x86_64-linux-gnu/libgomp.so.1
COPY --from=builder /usr/lib/x86_64-linux-gnu/libcpprest.so.2.10 /usr/lib/x86_64-linux-gnu/libcpprest.so.2.10
COPY --from=builder /usr/lib/x86_64-linux-gnu/libbrotlidec.so.1 /usr/lib/x86_64-linux-gnu/libbrotlidec.so.1
COPY --from=builder /usr/lib/x86_64-linux-gnu/libbrotlienc.so.1 /usr/lib/x86_64-linux-gnu/libbrotlienc.so.1
COPY --from=builder /usr/lib/x86_64-linux-gnu/libbrotlicommon.so.1 /usr/lib/x86_64-linux-gnu/libbrotlicommon.so.1
COPY --from=builder /usr/lib/x86_64-linux-gnu/libicuuc.so.70 /usr/lib/x86_64-linux-gnu/libicuuc.so.70
COPY --from=builder /usr/lib/x86_64-linux-gnu/libicudata.so.70 /usr/lib/x86_64-linux-gnu/libicudata.so.70
COPY --from=builder /usr/lib/x86_64-linux-gnu/libgflags.so.2.2 /usr/lib/x86_64-linux-gnu/libgflags.so.2.2
#COPY --from=builder /usr/lib/x86_64-linux-gnu/libgflags_nothreads.so.2.2 /usr/lib/x86_64-linux-gnu/libgflags_nothreads.so.2.2
COPY --from=builder /usr/local/lib/libfaiss.so /usr/local/lib/libfaiss.so
COPY --from=builder /usr/local/lib/libblas.a /usr/local/lib/libblas.a
COPY --from=builder /usr/local/lib/libopenblas.a /usr/local/lib/libopenblas.a
COPY --from=builder /usr/local/lib/libopenblas.so /usr/local/lib/libopenblas.so
COPY --from=builder /usr/local/lib/libopenblas.so.0 /usr/local/lib/libopenblas.so.0
COPY --from=builder /usr/local/lib/libopenblas_cooperlakep-r0.3.28.a /usr/local/lib/libopenblas_cooperlakep-r0.3.28.a
COPY --from=builder /usr/local/lib/libopenblas_cooperlakep-r0.3.28.so /usr/local/lib/libopenblas_cooperlakep-r0.3.28.so
RUN mkdir /opt/rank_model/
CMD ["/usr/local/bin/bertv2rank"]
# ENTRYPOINT ["tail", "-f", "/dev/null"]