forked from nuclia/nucliadb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.rust
49 lines (38 loc) · 1.97 KB
/
Dockerfile.rust
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
FROM python:3.11 as python_rust
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
TIKV_CLIENT_VERSION=0.0.3
COPY rust-toolchain.toml /tmp
WORKDIR /tmp
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='3dc5ef50861ee18657f9db2eeb7392f9c2a6c95c90ab41e45ab4ca71476b4338' ;; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='67777ac3bc17277102f2ed73fd5f14c51f4ca5963adadf7f174adf4ebc38747b' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='32a1532f7cef072a667bac53f1a5542c99666c4071af0c9549795bbdb2069ec1' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e50d1deb99048bc5782a0200aa33e4eea70747d49dffdc9d06812fd22a372515' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
rustVersion=$(awk -F '=' '/channel/ {print $2}' rust-toolchain.toml | tr -d '" '); \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain ${rustVersion} --default-host ${rustArch}; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;
# Install system dependencies
COPY scripts/install-system-deps.sh /tmp/
RUN /tmp/install-system-deps.sh && rm /tmp/install-system-deps.sh
RUN apt-get update -y && apt-get install --yes --no-install-recommends patchelf cmake && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN pip install maturin
RUN set -eux; \
wget "https://github.com/tikv/client-py/archive/refs/tags/${TIKV_CLIENT_VERSION}.tar.gz"; \
tar -xzf ${TIKV_CLIENT_VERSION}.tar.gz; \
cd client-py-${TIKV_CLIENT_VERSION}; \
maturin build --release; \
cp target/wheels/tikv_client-${TIKV_CLIENT_VERSION}-*.whl /
COPY . /nucliadb
WORKDIR /nucliadb
RUN set -eux; \
cd nucliadb_node_binding; \
maturin build --release