forked from wangxiaoying/chdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
91 lines (72 loc) 路 3.54 KB
/
Copy pathDockerfile
File metadata and controls
91 lines (72 loc) 路 3.54 KB
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
FROM python:3.11.13-slim-bullseye as base
FROM base as builder
ARG RUST_VERSION=1.91
ENV RUSTUP_HOME="/root/.rustup" \
CARGO_HOME="/root/.cargo" \
PATH="/root/.cargo/bin:$PATH"
RUN groupadd -g 1001 appgroup && \
useradd -u 1001 -g appgroup -m -d /home/appuser -s /bin/bash appuser
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update -qq \
&& apt-get install -y --no-install-recommends build-essential curl git wget tar ccache ninja-build nasm yasm gawk lsb-release software-properties-common gnupg libssl-dev checkinstall zlib1g-dev \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
RUN cd /tmp/ && wget --timeout=600 "https://github.com/Kitware/CMake/releases/download/v3.31.9/cmake-3.31.9-linux-x86_64.sh" -O cmake.sh \
&& sh cmake.sh --prefix=/usr/local/ --skip-license
RUN cd /usr/bin/ && wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 17
ENV PATH="$POETRY_HOME/bin:$PATH:/usr/local/cmake-3.31.9-linux-x86_64/bin"
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST_VERSION} --no-modify-path --profile minimal
RUN rustup default stable
RUN python --version && rustc --version && cargo --version && rm -rf /tmp/* /var/tmp/
WORKDIR /app
RUN git clone https://github.com/sfu-db/connector-x.git && cd /app/connector-x/connectorx && git checkout accio
WORKDIR /app/connector-x/connectorx-python
RUN pip install --no-cache-dir poetry tox wheel setuptools pybind11 twine
RUN poetry update pyyaml
WORKDIR /app/connector-x
RUN cargo install just
RUN pip install --force-reinstall -v "maturin==0.12.20"
#RUN pip install --force-reinstall -v "setuptools==47.0.0"
RUN just bootstrap-python
#RUN cd connectorx-python && maturin build --release -i python
RUN just build-python-wheel
RUN just build-cpp-release
WORKDIR /app
RUN git config --global http.postBuffer 524288000
RUN git config --global http.lowSpeedLimit 0
RUN git config --global http.lowSpeedTime 999999
RUN git clone https://github.com/wangxiaoying/chdb.git && cd chdb && git checkout v1.3.0_cx \
&& git tag v1.3.0 && git submodule update --init --recursive --jobs 4
WORKDIR /app/chdb
RUN ln -s /usr/bin/clang-17 /usr/bin/clang
RUN ln -s /usr/bin/clang++-17 /usr/bin/clang++
ENV CC=/usr/bin/clang
ENV CXX=/usr/bin/clang++
RUN echo 'set( CMAKE_CXX_COMPILER "/usr/bin/clang++" )' >> ./cmake/linux/toolchain-x86_64.cmake
RUN echo 'set( CMAKE_C_COMPILER "/usr/bin/clang" )' >> ./cmake/linux/toolchain-x86_64.cmake
RUN echo '[project]' >> pyproject.toml
RUN echo 'name = "chdb"' >> pyproject.toml
RUN echo 'version = "1.3.0"' >> pyproject.toml
RUN echo 'requires-python = ">=3.8"' >> pyproject.toml
RUN echo 'readme = "README.md"' >> pyproject.toml
RUN ./chdb/build.sh
RUN make wheel
RUN --mount=type=cache,target=/root/.cache/pypoetry \
poetry lock && poetry install --no-root
FROM base as runner
COPY --from=builder /app/chdb/dist/ /app/chdb/dist/
COPY --from=builder /app/connector-x/target/release/libconnectorx_cpp.so /app/connector-x/target/release/libconnectorx_cpp.so
COPY watch_script.sh /usr/local/bin/
COPY your_script_to_run.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/watch_script.sh /usr/local/bin/your_script_to_run.sh
ENTRYPOINT ["watch_script.sh"]