-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile_infinity_builder_centos7
176 lines (151 loc) · 8.29 KB
/
Dockerfile_infinity_builder_centos7
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
175
176
# NOTICE: This Dockerfile depends on BuildKit
# NOTICE: You should prepare the following files
# NOTICE: You can use the download_deps_infinity_builder_centos7.sh script to download them
# bison-3.8.2.tar.xz
# binutils-2.41.tar.xz
# gcc-13.2.0.tar.xz
# cmake-3.29.3-linux-x86_64.tar.gz
# ninja-linux.zip
# llvm-project-17.0.6.src.tar.xz
# boost_1_81_0.tar.bz2
# flex-2.6.4.tar.gz
# liburing-2.5.tar.gz
# libevent-2.1.12-stable.tar.gz
# lz4-1.9.4.tar.gz
# jemalloc-5.3.0.tar.bz2
# gperftools-2.15.tar.gz
# openssl-1.1.1w.tar.gz
# Python-3.12.4.tar.xz
FROM centos:7
RUN yum -y upgrade \
&& yum -y install git make wget which vim file gcc-c++ \
python3 python3-devel gettext-devel openssl-devel \
unzip bzip2 libtool m4 tree rpm-build postgresql \
&& echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf \
&& echo '/usr/local/lib64' >> /etc/ld.so.conf.d/local.conf
# Install bison-3.8.2
RUN --mount=type=bind,source=bison-3.8.2.tar.xz,target=/root/bison-3.8.2.tar.xz \
cd /root && tar xf bison-3.8.2.tar.xz && cd bison-3.8.2 \
&& ./configure && make -j && make install \
&& ldconfig && cd /root && rm -rf bison-3.8.2
# Install binutils-2.41
RUN --mount=type=bind,source=binutils-2.41.tar.xz,target=/root/binutils-2.41.tar.xz \
cd /root && tar xf binutils-2.41.tar.xz && cd binutils-2.41 \
&& ./configure --enable-gold \
&& make -j && make install-strip \
&& ldconfig && cd /root && rm -rf binutils-2.41
# Install gcc-13.2.0
RUN --mount=type=bind,source=gcc-13.2.0.tar.xz,target=/root/gcc-13.2.0.tar.xz \
cd /root && tar xf gcc-13.2.0.tar.xz \
&& cd gcc-13.2.0 && ./contrib/download_prerequisites \
&& cd /root && mkdir build-gcc && cd build-gcc \
&& ../gcc-13.2.0/configure --enable-languages=c,c++ \
--disable-multilib --with-pic \
&& make -j12 && make install-strip \
&& cd /root && rm -rf build-gcc && rm -rf gcc-13.2.0 \
&& ln -s gcc /usr/local/bin/cc && ldconfig
ENV LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
# Install cmake-3.29.3
RUN --mount=type=bind,source=cmake-3.29.3-linux-x86_64.tar.gz,target=/root/cmake-3.29.3-linux-x86_64.tar.gz \
cd /root && tar xf cmake-3.29.3-linux-x86_64.tar.gz \
&& cp -rf cmake-3.29.3-linux-x86_64/bin/* /usr/local/bin \
&& cp -rf cmake-3.29.3-linux-x86_64/share/* /usr/local/share \
&& rm -rf cmake-3.29.3-linux-x86_64
# Install ninja-1.12.1
RUN --mount=type=bind,source=ninja-linux.zip,target=/root/ninja-linux.zip \
cd /root && unzip ninja-linux.zip \
&& cp ninja /usr/local/bin && rm ninja
# Install clang-17.0.6
# Add -DCLANG_DEFAULT_LINKER=lld to use lld by default
# infinity seems to be incompatible with the lld linker
RUN --mount=type=bind,source=llvm-project-17.0.6.src.tar.xz,target=/root/llvm-project-17.0.6.src.tar.xz \
cd /root && tar xf llvm-project-17.0.6.src.tar.xz \
&& cd llvm-project-17.0.6.src && mkdir build && cd build \
&& cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_JOB_POOLS:STRING=link_pool=1 \
-DCMAKE_JOB_POOL_LINK:STRING=link_pool \
-DGCC_INSTALL_PREFIX=/usr/local \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt" \
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
-DLLVM_TARGETS_TO_BUILD=X86 ../llvm \
&& ninja -j12 install/strip \
&& ldconfig && cd /root && rm -rf llvm-project-17.0.6.src
# Install boost-1.81.0
RUN --mount=type=bind,source=boost_1_81_0.tar.bz2,target=/root/boost_1_81_0.tar.bz2 \
cd /root && tar xf boost_1_81_0.tar.bz2 \
&& cd boost_1_81_0 && ./bootstrap.sh --with-python=python3 \
&& ./b2 -j12 install \
&& ldconfig && cd /root && rm -rf boost_1_81_0
# Install flex-2.6.4
RUN --mount=type=bind,source=flex-2.6.4.tar.gz,target=/root/flex-2.6.4.tar.gz \
cd /root && tar xf flex-2.6.4.tar.gz \
&& cd flex-2.6.4 && ./autogen.sh && ./configure \
&& make -j && make install \
&& ldconfig && cd /root && rm -rf flex-2.6.4
# Install liburing-2.5
RUN --mount=type=bind,source=liburing-2.5.tar.gz,target=/root/liburing-2.5.tar.gz \
cd /root && tar xf liburing-2.5.tar.gz \
&& cd liburing-liburing-2.5 && make -j install \
&& ldconfig && cd /root && rm -rf liburing-liburing-2.5
# Install libevent-2.1.12
RUN --mount=type=bind,source=libevent-2.1.12-stable.tar.gz,target=/root/libevent-2.1.12-stable.tar.gz \
cd /root && tar xf libevent-2.1.12-stable.tar.gz \
&& cd libevent-2.1.12-stable && mkdir build && cd build \
&& cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="-fPIC" .. \
&& ninja -j0 install \
&& ldconfig && cd /root && rm -rf libevent-2.1.12-stable
# Install lz4-1.9.4
RUN --mount=type=bind,source=lz4-1.9.4.tar.gz,target=/root/lz4-1.9.4.tar.gz \
cd /root && tar xf lz4-1.9.4.tar.gz \
&& cd lz4-1.9.4 && CFLAGS="-fPIC" make -j install \
&& ldconfig && cd /root && rm -rf lz4-1.9.4
# Install zlib-1.3.1
RUN --mount=type=bind,source=zlib-1.3.1.tar.gz,target=/root/zlib-1.3.1.tar.gz \
cd /root && tar xf zlib-1.3.1.tar.gz \
&& cd zlib-1.3.1 && ./configure && CFLAGS="-fPIC" make -j install \
&& ldconfig && cd /root && rm -rf zlib-1.3.1
# Install jemalloc-5.3.0
# Known issue: Composition of `-fsanitize=address`, staticly linked jemalloc and `mallctl` cause crash at initialization.
# Refers to https://github.com/jemalloc/jemalloc/issues/2454
RUN --mount=type=bind,source=jemalloc-5.3.0.tar.bz2,target=/root/jemalloc-5.3.0.tar.bz2 \
cd /root && tar xjf jemalloc-5.3.0.tar.bz2 \
&& cd jemalloc-5.3.0 && CFLAGS="-fPIE" CXXFLAGS="-fPIE" ./configure --enable-static --disable-libdl --enable-prof --enable-prof-libunwind && make -j install \
&& ldconfig && cd /root && rm -rf jemalloc-5.3.0
# Install gperftools-2.15
RUN --mount=type=bind,source=gperftools-2.15.tar.gz,target=/root/gperftools-2.15.tar.gz \
cd /root && tar xzf gperftools-2.15.tar.gz \
&& cd gperftools-2.15 && ./configure && make -j 8 && make install \
&& ldconfig && cd /root && rm -rf gperftools-2.15
# download https://github.com/risinglightdb/sqllogictest-rs/releases/download/v0.20.2/sqllogictest-bin-v0.20.2-x86_64-unknown-linux-musl.tar.gz
RUN --mount=type=bind,source=sqllogictest-bin-v0.20.2-x86_64-unknown-linux-musl.tar.gz,target=/root/sqllogictest-bin-v0.20.2-x86_64-unknown-linux-musl.tar.gz \
cd /tmp && tar xzf /root/sqllogictest-bin-v0.20.2-x86_64-unknown-linux-musl.tar.gz && cp -rf sqllogictest /usr/local/bin && rm -fr /tmp/*
# OpenSSL
# pyhton 3.6+ ssl module requires openssl 1.1.1+
# "OpenSSL 1.1.x is not fully source compatible with OpenSSL 1.0.2." refers to https://github.com/openssl/openssl/issues/9772.
# This means installing to /usr/local/lib may break app compilation.
RUN --mount=type=bind,source=openssl-1.1.1w.tar.gz,target=/root/openssl-1.1.1w.tar.gz \
cd /root && tar xzf openssl-1.1.1w.tar.gz \
&& cd openssl-1.1.1w && ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared \
&& make -j 8 && make install \
&& ldconfig && cd /root && rm -rf openssl-1.1.1w
# packages need by python optional modules: _dbm _gdbm _lzma _sqlite3 _tkinter _uuid
# Too old: ncurses-devel sqlite-devel
# TODO: failed to build ncurses 5.4, 5.7, 5.9
RUN yum install -y gdbm-devel sqlite-devel xz-devel libffi-devel libuuid-devel bzip2-devel readline-devel tk-devel \
&& yum clean all
# Install Python 3.12
RUN --mount=type=bind,source=Python-3.12.4.tar.xz,target=/root/Python-3.12.4.tar.xz \
cd /root && tar xJf Python-3.12.4.tar.xz \
&& cd Python-3.12.4 && ./configure --with-openssl=/usr/local/openssl --with-openssl-rpath=auto --enable-shared && make -j 8 && make install \
&& ldconfig && cd /root && rm -rf Python-3.12.4
# Create a python virtual environment. Set PATH so that the shell activate this virtual environment automatically when entering a container from this image.
RUN /usr/local/bin/python3 -m venv /usr/local/venv
ENV PATH="/usr/local/venv/bin:/usr/local/bin:$PATH"
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ && pip3 config set global.trusted-host pypi.tuna.tsinghua.edu.cn && pip3 install wheel twine
# infinity python SDK dependencies
COPY python/requirements.txt .
RUN --mount=type=bind,source=python/requirements.txt,target=/root/requirements.txt pip3 install --no-input -r /root/requirements.txt
ENV CC=clang CXX=clang++ LZ4_ROOT=/usr/local
ENTRYPOINT [ "bash", "-c", "while true; do sleep 60; done"]