-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (47 loc) · 1.26 KB
/
Dockerfile
File metadata and controls
68 lines (47 loc) · 1.26 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
FROM rust:1.85-bookworm AS chef
WORKDIR /app
# System dependencies (for prost-build and rocksdb)
RUN apt-get update && apt-get install -y \
protobuf-compiler \
clang \
libclang-dev \
llvm-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*
RUN cargo install cargo-chef
# Planner Stage
FROM chef AS planner
COPY Cargo.toml Cargo.lock ./
COPY crates ./crates
RUN cargo chef prepare --recipe-path recipe.json
# Builder Stage
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Building only the dependencies
RUN cargo chef cook --release --recipe-path recipe.json
COPY Cargo.toml Cargo.lock ./
COPY crates ./crates
# Building the binary
RUN cargo build --release --bin server
# Runtime Stage
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m vortexdb
WORKDIR /app
RUN mkdir -p /data && chown -R vortexdb:vortexdb /data
COPY --from=builder /app/target/release/server /usr/local/bin/server
# Safe defualts
ENV HTTP_HOST=0.0.0.0
ENV HTTP_PORT=3000
ENV GRPC_HOST=0.0.0.0
ENV GRPC_PORT=50051
ENV STORAGE_TYPE=inmemory
ENV INDEX_TYPE=flat
ENV LOGGING=true
ENV DISABLE_HTTP=false
EXPOSE 3000
EXPOSE 50051
USER vortexdb
ENTRYPOINT ["server"]