-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM ubuntu:22.04 | ||
ENV container docker | ||
ENV PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" | ||
ENV LANG ja_JP.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
|
||
RUN apt update | ||
RUN apt -y install build-essential cmake git curl vim unzip wget zip libopenblas-base libopenblas-dev libsnappy-dev liblz4-dev libzstd-dev libz-dev libbz2-dev | ||
|
||
VOLUME ["/sys/fs/cgroup"] | ||
STOPSIGNAL SIGRTMIN+3 | ||
CMD ["/sbin/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
cd `dirname $0` | ||
|
||
git clone https://github.com/syndbg/goenv.git | ||
|
||
git clone https://github.com/facebook/rocksdb.git | ||
pushd rocksdb | ||
git checkout -b v6.15.5 refs/tags/v6.15.5 | ||
popd | ||
|
||
rm -rf faiss | ||
mkdir faiss | ||
pushd faiss | ||
wget https://github.com/facebookresearch/faiss/archive/refs/tags/v1.7.3.tar.gz | ||
tar xzvf v1.7.3.tar.gz | ||
popd | ||
|
||
rm -rf protoc | ||
mkdir protoc | ||
pushd protoc | ||
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip | ||
unzip protoc-3.15.8-linux-x86_64.zip | ||
popd | ||
|
||
rm -rf faissdb | ||
git clone https://github.com/crumbjp/faissdb.git | ||
|
||
docker rm faissdb-base | ||
docker rmi crumbjp/faissdb:base | ||
docker rmi crumbjp/faissdb | ||
|
||
docker % docker image build -t crumbjp/faissdb:base . | ||
docker run --name=faissdb-base -ti --tmpfs /run --tmpfs /run/lock --tmpfs /tmp:exec \ | ||
--cap-add SYS_ADMIN --device=/dev/fuse \ | ||
--security-opt apparmor:unconfined \ | ||
--security-opt seccomp:unconfined \ | ||
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \ | ||
-v /lib/modules:/lib/modules:ro \ | ||
-v `pwd`/mnt:/mnt \ | ||
-d crumbjp/faissdb:base \ | ||
/bin/bash | ||
|
||
docker exec faissdb-base bash --login /mnt/faissdb.sh | ||
|
||
docker commit faissdb-base crumbjp/faissdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env bash | ||
cd /mnt | ||
|
||
cp -r /mnt/goenv /usr/local/ | ||
export GOENV_ROOT=/usr/local/goenv | ||
export PATH=$GOENV_ROOT/bin:$PATH | ||
export GO111MODULE=on | ||
eval "$(goenv init -)" | ||
|
||
echo ' | ||
export GOENV_ROOT=/usr/local/goenv | ||
export PATH=$GOENV_ROOT/bin:$PATH | ||
eval "$(goenv init -)" | ||
export GO111MODULE=on | ||
' >> /etc/profile | ||
|
||
goenv install 1.15.9 | ||
goenv global 1.15.9 | ||
|
||
cd /mnt/rocksdb | ||
make static_lib | ||
make install | ||
|
||
cd /mnt/faiss/faiss-1.7.3 | ||
cmake -B build -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF -DFAISS_ENABLE_C_API=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release . | ||
make -C build install | ||
cp build/c_api/libfaiss_c.so /usr/local/lib | ||
ldconfig | ||
|
||
cd /mnt/protoc | ||
cp bin/protoc /usr/local/bin/ | ||
cp -r include/google /usr/local/include/ | ||
|
||
go get google.golang.org/protobuf/cmd/protoc-gen-go google.golang.org/grpc/cmd/protoc-gen-go-grpc | ||
|
||
cd /mnt/faissdb | ||
git submodule init | ||
git submodule update | ||
cd server | ||
make && : | ||
GOPATH=`go env GOPATH` | ||
DYNFLAG_GO=`find $GOPATH/pkg/mod/github.com/tecbot -name dynflag.go` | ||
echo ' | ||
// +build !linux !static | ||
package gorocksdb | ||
// #cgo LDFLAGS: -L/usr/local/lib -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd -ldl | ||
import "C" | ||
' > $DYNFLAG_GO | ||
echo 'Re build with fixed LDFLAGS' | ||
make | ||
|
||
mkdir -p /usr/local/faissdb/bin /usr/local/faissdb/data /usr/local/faissdb/log /usr/local/faissdb/tmp | ||
cp -f server/faissdb /usr/local/faissdb/bin/faissdb |