forked from nuclia/nucliadb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.node
110 lines (90 loc) · 3.72 KB
/
Dockerfile.node
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
FROM eu.gcr.io/stashify-218417/basenode:latest as planner
# XXX As COPY copies the contents of a directory and not the directory itself,
# we use multiple COPY commands to avoid including Pyhton sources. Ideally, we
# should have a single COPY command getting all Rust code.
COPY Cargo.toml \
Cargo.lock \
rust-toolchain.toml \
/nucliadb/
COPY .cargo/config.toml /nucliadb/.cargo/
COPY nucliadb_core /nucliadb/nucliadb_core
COPY nucliadb_node /nucliadb/nucliadb_node
COPY nucliadb_node_binding /nucliadb/nucliadb_node_binding
COPY nucliadb_paragraphs /nucliadb/nucliadb_paragraphs
COPY nucliadb_procs /nucliadb/nucliadb_procs
COPY nucliadb_protos /nucliadb/nucliadb_protos
COPY nucliadb_relations /nucliadb/nucliadb_relations
COPY nucliadb_relations2 /nucliadb/nucliadb_relations2
COPY nucliadb_texts /nucliadb/nucliadb_texts
COPY nucliadb_vectors /nucliadb/nucliadb_vectors
COPY vectors_benchmark /nucliadb/vectors_benchmark
WORKDIR /nucliadb
RUN cargo chef prepare --recipe-path recipe.json
# --------------------------------------------------------------------
FROM eu.gcr.io/stashify-218417/basenode:latest as builder
ARG CARGO_FEATURES=release-feature-set
ARG CARGO_PROFILE=release
ENV RUSTFLAGS="--cfg prometheus_metrics --cfg tokio_unstable"
# Install system dependencies
COPY scripts/install-system-deps.sh /tmp/
RUN /tmp/install-system-deps.sh && rm /tmp/install-system-deps.sh && rm -rf /var/lib/apt/lists/*
COPY --from=planner /nucliadb/recipe.json recipe.json
# Build dependencies (this is the cached docker layer)
RUN cargo chef cook \
--recipe-path recipe.json \
--features $CARGO_FEATURES \
$(test "$CARGO_PROFILE" = "release" && echo "--release")
# XXX same as above
COPY Cargo.toml \
Cargo.lock \
rust-toolchain.toml \
/nucliadb/
COPY .cargo/config.toml /nucliadb/.cargo/
COPY nucliadb_core /nucliadb/nucliadb_core
COPY nucliadb_node /nucliadb/nucliadb_node
COPY nucliadb_node_binding /nucliadb/nucliadb_node_binding
COPY nucliadb_paragraphs /nucliadb/nucliadb_paragraphs
COPY nucliadb_procs /nucliadb/nucliadb_procs
COPY nucliadb_protos /nucliadb/nucliadb_protos
COPY nucliadb_relations /nucliadb/nucliadb_relations
COPY nucliadb_relations2 /nucliadb/nucliadb_relations2
COPY nucliadb_texts /nucliadb/nucliadb_texts
COPY nucliadb_vectors /nucliadb/nucliadb_vectors
COPY vectors_benchmark /nucliadb/vectors_benchmark
RUN mkdir -p /nucliadb/tmp
ENV TMPDIR=/nucliadb/tmp
WORKDIR /nucliadb
RUN echo "Building workspace with feature(s) '$CARGO_FEATURES' and profile '$CARGO_PROFILE'" \
&& rm -rf /nucliadb/tmp/* \
&& rm -rf target \
&& cargo build \
--locked \
--features $CARGO_FEATURES \
-p nucliadb_node \
$(test "$CARGO_PROFILE" = "release" && echo "--release") \
&& echo "Moving binaries to /nucliadb/bin" \
&& mkdir -p /nucliadb/bin \
&& find target/$CARGO_PROFILE -maxdepth 1 -perm /a+x -type f -exec mv {} /nucliadb/bin \; \
&& rm -rf target \
&& rm -rf /nucliadb/tmp/* \
&& cargo install rust-spy \
&& cargo clean
# --------------------------------------------------------------------
FROM debian:bullseye-slim AS nucliadb
ENV DATA_PATH=data
ENV RUST_LOG=nucliadb_node=DEBUG
ENV RUST_BACKTRACE=1
RUN apt-get -y update \
&& apt-get -y install ca-certificates curl \
libssl1.1 \
lmdb-utils \
libdw-dev \
linux-perf \
linux-base \
&& cp /usr/bin/perf_5.10 /usr/bin/perf_5.15 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=eu.gcr.io/stashify-218417/basenode:latest /bin/grpc_health_probe /bin/grpc_health_probe
COPY --from=builder /nucliadb/bin/node_reader /usr/local/bin/node_reader
COPY --from=builder /nucliadb/bin/node_writer /usr/local/bin/node_writer
COPY --from=builder /usr/local/cargo/bin/rust-spy /usr/local/bin/rust-spy
EXPOSE 4444/udp