-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (30 loc) · 1.35 KB
/
Dockerfile
File metadata and controls
39 lines (30 loc) · 1.35 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
# ---- Build Stage ----
FROM rust:1.87.0 AS builder
WORKDIR /app
ENV CARGO_DRIFT_FFI_PATH="/usr/local/lib"
# 1. Cache dependencies first
RUN apt-get update && apt-get install jq -y && rustup component add rustfmt
# TODO: docker layer cache
# COPY Cargo.toml Cargo.lock ./
# RUN mkdir src && echo "fn main() {}" > src/main.rs
# install libdrift
RUN SO_URL=$(curl -s https://api.github.com/repos/drift-labs/drift-ffi-sys/releases/latest | jq -r '.assets[] | select(.name=="libdrift_ffi_sys.so") | .browser_download_url') &&\
curl -L -o libdrift_ffi_sys.so "$SO_URL" &&\
cp libdrift_ffi_sys.so $CARGO_DRIFT_FFI_PATH
# 2. Copy actual code and rebuild
# TODO: docker layer cache
# RUN cargo build --release && rm -rf src
COPY . .
RUN cargo build --release
# ---- Runtime Stage ----
FROM debian:bookworm-slim
# RUN apt-get update && apt-get install -y ca-certificates lldb
RUN apt-get update && apt-get install -y ca-certificates
COPY --from=builder /usr/local/lib/libdrift_ffi_sys.so /lib/
# COPY --from=builder /app/target/release/keeprs /usr/local/bin/keeprs-real
COPY --from=builder /app/target/release/keeprs /usr/local/bin/keeprs
# RUN echo '#!/bin/bash\nexec lldb -o "run" -o "bt all" -o "quit" -- /usr/local/bin/keeprs-real "$@"' > /usr/local/bin/keeprs && \
# chmod +x /usr/local/bin/keeprs
EXPOSE 9898
ENV METRICS_PORT=9898
ENTRYPOINT ["/usr/local/bin/keeprs"]