-
Notifications
You must be signed in to change notification settings - Fork 64
/
Dockerfile
49 lines (36 loc) · 1.43 KB
/
Dockerfile
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
#syntax=docker/dockerfile:1.2
ARG RUST_VERSION=1.78
FROM rust:${RUST_VERSION}-slim-bookworm as build
# cache mounts below may already exist and owned by root
USER root
RUN apt update \
&& apt install --yes pkg-config libssl-dev build-essential libsqlite3-dev cmake protobuf-compiler unixodbc-dev \
&& rm -rf /var/lib/{apt,dpkg,cache,log}
COPY . /build
WORKDIR /build
ARG CARGO_FEATURES
ARG CARGO_INCREMENTAL=yes
ARG CARGO_NET_GIT_FETCH_WITH_CLI=false
ENV CARGO_FEATURES=$CARGO_FEATURES \
CARGO_INCREMENTAL=$CARGO_INCREMENTAL \
CARGO_NET_GIT_FETCH_WITH_CLI=$CARGO_NET_GIT_FETCH_WITH_CLI
RUN \
--mount=type=cache,id=spiceai_registry,sharing=locked,target=/usr/local/cargo/registry \
--mount=type=cache,id=spiceai_git,sharing=locked,target=/usr/local/cargo/git \
--mount=type=cache,id=spiceai_target,sharing=locked,target=/build/target \
cargo build --release --features ${CARGO_FEATURES:-default} && \
cp /build/target/release/spiced /root/spiced
FROM debian:bookworm-slim
ARG CARGO_FEATURES
RUN apt update \
&& apt install --yes ca-certificates libssl3 --no-install-recommends \
&& rm -rf /var/lib/{apt,dpkg,cache,log}
RUN if echo "$CARGO_FEATURES" | grep -q "odbc"; then \
apt update \
&& apt install --yes unixodbc --no-install-recommends \
&& rm -rf /var/lib/{apt,dpkg,cache,log}; \
fi
COPY --from=build /root/spiced /usr/local/bin/spiced
EXPOSE 3000 50051
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/spiced"]