Skip to content

Commit 2daec74

Browse files
committed
Dockerfile.new
1 parent 873c8a5 commit 2daec74

2 files changed

Lines changed: 100 additions & 0 deletions

File tree

docker/Dockerfile.new

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Dockerfile
2+
# chrono@2021-03
3+
4+
# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
5+
# sudo service docker start
6+
# sudo usermod -aG docker ${USER}
7+
8+
# docker build -t chronolaw/cpp_study .
9+
10+
# docker run -it --rm chronolaw/cpp_study
11+
12+
ARG SRC_IMAGE="gcc:7"
13+
14+
FROM ${SRC_IMAGE}
15+
16+
WORKDIR /root
17+
18+
COPY setup.sh ./
19+
20+
RUN ./setup.sh
21+
22+
CMD ["/bin/bash"]

docker/setup.sh

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/sh
2+
3+
# chrono @ 2021-03
4+
5+
# apt-get
6+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
7+
vim cmake gdb pstack strace \
8+
libmsgpack-dev protobuf-compiler libprotobuf-dev libprotoc-dev \
9+
libcurl4-openssl-dev libzmq3-dev \
10+
python3-dev python3-pip \
11+
google-perftools libgoogle-perftools-dev
12+
13+
DEBIAN_FRONTEND=noninteractive apt-get autoremove -y
14+
15+
# python3 pybind11
16+
pip3 install pybind11
17+
18+
#WORKDIR='/root/'
19+
20+
HOME='/root'
21+
22+
git clone https://github.com/chronolaw/cpp_study --depth=1
23+
24+
# setubp env
25+
cp ${HOME}/cpp_study/env/vimrc ${HOME}/.vimrc \
26+
cp ${HOME}/cpp_study/env/bashrc ${HOME}/.bashrc \
27+
cp ${HOME}/cpp_study/env/gitconfig ${HOME}/.gitconfig \
28+
29+
# source
30+
31+
JSON_VERSION="3.9.1"
32+
CPR_VERSION="1.4.0"
33+
LUAJIT_VERSION="2.1-20200102"
34+
LUABRIDAGE_VERSION="2.6"
35+
GPERF_VERSION="2.8"
36+
37+
#echo ${JSON_VERSION}
38+
39+
mkdir ${HOME}/github
40+
cd ${HOME}/github
41+
42+
# json
43+
curl -fsL https://github.com/nlohmann/json/releases/download/v${JSON_VERSION}/json.hpp -o json.hpp
44+
ln -s ~/github/json.hpp ~/cpp_study/common/
45+
46+
# curl/cpr
47+
curl -fsL https://github.com/whoshuu/cpr/archive/${CPR_VERSION}.tar.gz -o cpr.tgz
48+
tar xfz cpr.tgz
49+
cd cpr-${CPR_VERSION}
50+
cmake . -DUSE_SYSTEM_CURL=ON -DBUILD_CPR_TESTS=OFF
51+
make && make install && make clean
52+
cd ..
53+
54+
# luajit
55+
curl -fsL https://github.com/openresty/luajit2/archive/v${LUAJIT_VERSION}.tar.gz -o luajit.tgz
56+
tar xfz luajit.tgz
57+
cd luajit2-${LUAJIT_VERSION}
58+
make && make install && make clean
59+
ln -s /usr/local/lib/libluajit-5.1.so.2 /lib/x86_64-linux-gnu/
60+
cd ..
61+
62+
# luabridge
63+
curl -fsL https://github.com/vinniefalco/LuaBridge/archive/${LUABRIDAGE_VERSION}.tar.gz -o LuaBridge.tgz
64+
tar xfz LuaBridge.tgz
65+
ln -s ~/github/LuaBridge-${LUABRIDAGE_VERSION}/Source/LuaBridge/ ~/cpp_study/common/
66+
67+
# gperftools
68+
curl -fsL https://github.com/gperftools/gperftools/releases/download/gperftools-${GPERF_VERSION}/gperftools-${GPERF_VERSION}.tar.gz -o gperf.tgz
69+
tar xfz gperf.tgz
70+
ln -s ~/github/gperftools-${GPERF_VERSION}/pprof-symbolize /bin/pprof
71+
72+
# flame graph
73+
git clone https://github.com/brendangregg/FlameGraph.git --depth=1
74+
ln -s ~/github/FlameGraph/flamegraph.pl ~/cpp_study/section4/
75+
76+
# clean
77+
rm *.tgz
78+

0 commit comments

Comments
 (0)