-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile-cpu
62 lines (48 loc) · 1.42 KB
/
Dockerfile-cpu
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
FROM rust:1.84-slim-bookworm AS rust-builder
RUN apt-get update && apt-get install -y \
libssl3 \
pkg-config \
libssl-dev \
g++ \
build-essential \
ca-certificates \
libgflags-dev \
libsnappy-dev \
zlib1g-dev \
libbz2-dev \
libzstd-dev \
libxml2-dev \
protobuf-compiler \
python3 \
curl \
git
# Set environment variables for v8 build
ENV RUSTY_V8_MIRROR=https://github.com/denoland/rusty_v8/releases/download
ENV V8_FROM_SOURCE=0
WORKDIR /usr/src/app
COPY . .
RUN cargo build --release
FROM python:3.11-slim
RUN apt-get update && \
apt-get install -y curl && \
curl -sSL "https://github.com/fullstorydev/grpcurl/releases/download/v1.8.9/grpcurl_1.8.9_linux_x86_64.tar.gz" | tar -xz -C /usr/local/bin && \
chmod +x /usr/local/bin/grpcurl && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY src/ai_server /app/ai_server
RUN cd ai_server && pip install --no-cache-dir -r requirements-cpu.txt
COPY --from=rust-builder /usr/src/app/target/release/oramacore /app/oramacore
RUN mkdir -p /root/.cache/huggingface
RUN echo '#!/bin/bash\n\
cd ai_server && python server.py &\n\
\n\
until grpcurl -plaintext localhost:50051 orama_ai_service.LLMService/CheckHealth 2>/dev/null | grep -q "\"status\": \"OK\""; do\n\
echo "Waiting for Python gRPC server..."\n\
sleep 1\n\
done\n\
\n\
cd /app && ./oramacore\n\
' > /app/start.sh
RUN chmod +x /app/start.sh
EXPOSE 8080 50051
CMD ["/app/start.sh"]