Skip to content

Commit

Permalink
add compile Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-hanqing committed Jul 23, 2020
1 parent 3f977aa commit 8bb3c25
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 6 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM centos

WORKDIR /curve-tmp
RUN cp -a /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && \
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo && \
yum clean all && yum makecache

RUN yum groupinstall -y "Development Tools"
RUN yum install -y unzip which zlib zlib-devel openssl openssl-devel libnl3 libnl3-devel libuuid libuuid-devel libcurl-devel boost boost-devel wget cmake epel-release python2-pip python2-wheel python2-devel && \
yum install -y libunwind libunwind-devel

# install libfiu
RUN wget https://curve-build.nos-eastchina1.126.net/libfiu-1.00.tar.gz && \
tar -zxvf libfiu-1.00.tar.gz && \
cd libfiu-1.00 && make libfiu && make libfiu_install

# install bazel, later using download
RUN wget https://curve-build.nos-eastchina1.126.net/bazel-0.17.2-installer-linux-x86_64.sh && \
bash bazel-0.17.2-installer-linux-x86_64.sh

WORKDIR /
RUN rm -rf /curve-tmp

2 changes: 1 addition & 1 deletion mk-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -462,5 +462,5 @@ done
# 替换curvefs setup.py中的版本号
sed -i "s/version-anchor/${tag_version}+${commit_id}${debug}/g" setup.py

python setup.py bdist_wheel
python2 setup.py bdist_wheel
cp dist/*whl $dir
21 changes: 16 additions & 5 deletions mk-tar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ cd ${dir}

cp ${dir}/thirdparties/etcdclient/libetcdclient.h ${dir}/include/etcdclient/etcdclient.h

if [ `gcc -dumpversion | awk -F'.' '{print $1}'` -le 6 ]
then
bazelflags=''
else
bazelflags='--copt -faligned-new'
fi

if [ "$1" = "debug" ]
then
bazel build ... --copt -DHAVE_ZLIB=1 --compilation_mode=dbg -s --define=with_glog=true \
--define=libunwind=true --copt -DGFLAGS_NS=google --copt \
-Wno-error=format-security --copt -DUSE_BTHREAD_MUTEX --copt -DCURVEVERSION=${tag_version}
-Wno-error=format-security --copt -DUSE_BTHREAD_MUTEX --copt -DCURVEVERSION=${tag_version} \
--linkopt -L/usr/local/lib ${bazelflags}
if [ $? -ne 0 ]
then
echo "build phase1 failed"
Expand All @@ -75,7 +83,8 @@ bazel build curvefs_python:curvefs --copt -DHAVE_ZLIB=1 --compilation_mode=dbg
--define=with_glog=true --define=libunwind=true --copt -DGFLAGS_NS=google \
--copt \
-Wno-error=format-security --copt -DUSE_BTHREAD_MUTEX --linkopt \
-L${dir}/curvefs_python/tmplib/ --copt -DCURVEVERSION=${tag_version}
-L${dir}/curvefs_python/tmplib/ --copt -DCURVEVERSION=${tag_version} \
--linkopt -L/usr/local/lib ${bazelflags}
if [ $? -ne 0 ]
then
echo "build phase2 failed"
Expand All @@ -84,7 +93,8 @@ fi
else
bazel build ... --copt -DHAVE_ZLIB=1 --copt -O2 -s --define=with_glog=true \
--define=libunwind=true --copt -DGFLAGS_NS=google --copt \
-Wno-error=format-security --copt -DUSE_BTHREAD_MUTEX --copt -DCURVEVERSION=${tag_version}
-Wno-error=format-security --copt -DUSE_BTHREAD_MUTEX --copt -DCURVEVERSION=${tag_version} \
--linkopt -L/usr/local/lib ${bazelflags}
if [ $? -ne 0 ]
then
echo "build phase1 failed"
Expand All @@ -100,7 +110,8 @@ bazel build curvefs_python:curvefs --copt -DHAVE_ZLIB=1 --copt -O2 -s \
--define=with_glog=true --define=libunwind=true --copt -DGFLAGS_NS=google \
--copt \
-Wno-error=format-security --copt -DUSE_BTHREAD_MUTEX --linkopt \
-L${dir}/curvefs_python/tmplib/ --copt -DCURVEVERSION=${tag_version}
-L${dir}/curvefs_python/tmplib/ --copt -DCURVEVERSION=${tag_version} \
--linkopt -L/usr/local/lib ${bazelflags}
if [ $? -ne 0 ]
then
echo "build phase2 failed"
Expand Down Expand Up @@ -419,6 +430,6 @@ done
# 替换curvefs setup.py中的版本号
sed -i "s/version-anchor/${tag_version}+${commit_id}${debug}/g" setup.py

python setup.py bdist_wheel
python2 setup.py bdist_wheel
cp dist/*whl $dir
echo "end make python whell"
27 changes: 27 additions & 0 deletions replace-curve-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -e

sed -i "s;https://dl.google.com/go/go1.12.8.linux-amd64.tar.gz;https://curve-build.nos-eastchina1.126.net/go1.12.8.linux-amd64.tar.gz;g" thirdparties/etcdclient/Makefile
sed -i "s;https://github.com/etcd-io/etcd;https://gitee.com/mirrors/etcd;g" thirdparties/etcdclient/Makefile

# braft
sed -i "s;https://github.com/baidu/braft;https://gitee.com/baidu/braft;g" WORKSPACE

# protobuf
sed -i "s;https://github.com/google/protobuf/archive/v3.5.0.zip;https://curve-build.nos-eastchina1.126.net/protobuf-3.5.0.zip;g" WORKSPACE

# googletest
sed -i "s;https://github.com/google/googletest;https://gitee.com/mirrors/googletest;g" WORKSPACE

# gflags
sed -i "s;https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz;https://curve-build.nos-eastchina1.126.net/gflags-2.2.2.tar.gz;g" WORKSPACE

# leveldb
sed -i "s;https://github.com/google/leveldb/archive/a53934a3ae1244679f812d998a4f16f2c7f309a6.tar.gz;https://curve-build.nos-eastchina1.126.net/leveldb-a53934a3ae1244679f812d998a4f16f2c7f309a6.tar.gz;g" WORKSPACE

# brpc
sed -i "s;https://github.com/apache/incubator-brpc;https://gitee.com/baidu/BRPC;g" WORKSPACE

# jsoncpp
sed -i "s;https://github.com/open-source-parsers/jsoncpp.git;https://gitee.com/mirrors/jsoncpp;g" WORKSPACE

0 comments on commit 8bb3c25

Please sign in to comment.