-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (52 loc) · 2.46 KB
/
Copy pathDockerfile
File metadata and controls
69 lines (52 loc) · 2.46 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
# QueryEngine Rust/Dockerfile
# Multi-stage build for Rust application
FROM rust:1.89 AS builder
LABEL maintainer="SketchDB Team"
LABEL description="QueryEngine Rust service for SketchDB"
WORKDIR /code
# Required by prost-build dependencies (e.g., asap_sketchlib) during cargo build
RUN apt-get update && apt-get install -y --no-install-recommends \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
# Copy the asap-common directory
COPY asap-common ./asap-common
COPY Cargo.toml ./
COPY Cargo.lock ./
COPY asap-query-engine/Cargo.toml ./asap-query-engine/
COPY asap-planner-rs/Cargo.toml ./asap-planner-rs/
# Create dummy source files so Cargo can resolve all workspace members
# All explicit [[bin]] targets in Cargo.toml must have stubs here for the dependency cache layer
RUN mkdir -p asap-query-engine/src/bin \
&& echo "fn main() {}" > asap-query-engine/src/main.rs \
&& echo "fn main() {}" > asap-query-engine/src/bin/precompute_engine.rs \
&& echo "fn main() {}" > asap-query-engine/src/bin/test_e2e_precompute.rs \
&& echo "fn main() {}" > asap-query-engine/src/bin/bench_precompute_sketch.rs \
&& echo "fn main() {}" > asap-query-engine/src/bin/e2e_quickstart_resource_test.rs \
&& mkdir -p asap-query-engine/benches && echo "fn main() {}" > asap-query-engine/benches/simple_store_bench.rs \
&& mkdir -p asap-planner-rs/src && echo "fn main() {}" > asap-planner-rs/src/main.rs \
&& echo "pub fn placeholder() {}" >> asap-planner-rs/src/lib.rs
# Build dependencies (this layer will be cached)
WORKDIR /code/asap-query-engine
RUN cargo build --release && rm -rf src/
# Copy source code
COPY asap-query-engine/src ./src
COPY asap-planner-rs/src /code/asap-planner-rs/src
# Build the actual application
RUN touch src/main.rs && touch /code/asap-planner-rs/src/lib.rs && cargo build --release
# Runtime stage with Ubuntu 24.04 (has newer glibc/libstdc++)
FROM ubuntu:24.04
WORKDIR /app
# Install minimal runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
zlib1g \
&& rm -rf /var/lib/apt/lists/*
# Copy the built binary
COPY --from=builder /code/target/release/query_engine_rust /usr/local/bin/query_engine_rust
# Expose the HTTP server port
EXPOSE 8088
# Note: Running as root to match Python QueryEngine behavior
# This allows writing to mounted volumes without permission issues
# Use ENTRYPOINT to allow passing command line arguments
ENTRYPOINT ["query_engine_rust"]