mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-20 07:51:23 +02:00
fix: updated docker container for reranking
This commit is contained in:
62
Dockerfile
62
Dockerfile
@@ -1,7 +1,10 @@
|
|||||||
# === Builder Stage ===
|
# === Builder ===
|
||||||
FROM clux/muslrust:1.86.0-stable as builder
|
FROM rust:1.86-bookworm AS builder
|
||||||
|
|
||||||
WORKDIR /usr/src/minne
|
WORKDIR /usr/src/minne
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
pkg-config clang cmake git && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Cache deps
|
||||||
COPY Cargo.toml Cargo.lock ./
|
COPY Cargo.toml Cargo.lock ./
|
||||||
RUN mkdir -p api-router common composite-retrieval html-router ingestion-pipeline json-stream-parser main worker
|
RUN mkdir -p api-router common composite-retrieval html-router ingestion-pipeline json-stream-parser main worker
|
||||||
COPY api-router/Cargo.toml ./api-router/
|
COPY api-router/Cargo.toml ./api-router/
|
||||||
@@ -11,43 +14,38 @@ COPY html-router/Cargo.toml ./html-router/
|
|||||||
COPY ingestion-pipeline/Cargo.toml ./ingestion-pipeline/
|
COPY ingestion-pipeline/Cargo.toml ./ingestion-pipeline/
|
||||||
COPY json-stream-parser/Cargo.toml ./json-stream-parser/
|
COPY json-stream-parser/Cargo.toml ./json-stream-parser/
|
||||||
COPY main/Cargo.toml ./main/
|
COPY main/Cargo.toml ./main/
|
||||||
|
RUN cargo build --release --bin main --features ingestion-pipeline/docker || true
|
||||||
|
|
||||||
# Build with the MUSL target
|
# Build
|
||||||
RUN cargo build --release --target x86_64-unknown-linux-musl --bin main --features ingestion-pipeline/docker || true
|
|
||||||
|
|
||||||
# Copy the rest of the source code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN cargo build --release --bin main --features ingestion-pipeline/docker
|
||||||
|
|
||||||
# Build the final application binary with the MUSL target
|
# === Runtime ===
|
||||||
RUN cargo build --release --target x86_64-unknown-linux-musl --bin main --features ingestion-pipeline/docker
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
# === Runtime Stage ===
|
# Chromium + runtime deps + OpenMP for ORT
|
||||||
FROM alpine:latest
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
chromium libnss3 libasound2 libgbm1 libxshmfence1 \
|
||||||
|
ca-certificates fonts-dejavu fonts-noto-color-emoji \
|
||||||
|
libgomp1 libstdc++6 curl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN apk update && apk add --no-cache \
|
# ONNX Runtime (CPU). Change if you bump ort.
|
||||||
chromium \
|
ARG ORT_VERSION=1.21.0
|
||||||
nss \
|
RUN mkdir -p /opt/onnxruntime && \
|
||||||
freetype \
|
curl -fsSL -o /tmp/ort.tgz \
|
||||||
harfbuzz \
|
"https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}/onnxruntime-linux-x64-${ORT_VERSION}.tgz" && \
|
||||||
ca-certificates \
|
tar -xzf /tmp/ort.tgz -C /opt/onnxruntime --strip-components=1 && rm /tmp/ort.tgz
|
||||||
ttf-freefont \
|
|
||||||
font-noto-emoji \
|
|
||||||
&& \
|
|
||||||
rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
ENV CHROME_BIN=/usr/bin/chromium-browser \
|
ENV CHROME_BIN=/usr/bin/chromium \
|
||||||
CHROME_PATH=/usr/lib/chromium/ \
|
SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
|
||||||
SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
|
ORT_DYLIB_PATH=/opt/onnxruntime/lib/libonnxruntime.so
|
||||||
|
|
||||||
# Create a non-root user to run the application
|
# Non-root
|
||||||
RUN adduser -D -h /home/appuser appuser
|
RUN useradd -m appuser
|
||||||
WORKDIR /home/appuser
|
|
||||||
USER appuser
|
USER appuser
|
||||||
|
WORKDIR /home/appuser
|
||||||
|
|
||||||
# Copy the compiled binary from the builder stage (note the target path)
|
COPY --from=builder /usr/src/minne/target/release/main /usr/local/bin/main
|
||||||
COPY --from=builder /usr/src/minne/target/x86_64-unknown-linux-musl/release/main /usr/local/bin/main
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
# EXPOSE 8000-9000
|
|
||||||
|
|
||||||
CMD ["main"]
|
CMD ["main"]
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ services:
|
|||||||
SURREALDB_PASSWORD: "root_password"
|
SURREALDB_PASSWORD: "root_password"
|
||||||
SURREALDB_DATABASE: "test"
|
SURREALDB_DATABASE: "test"
|
||||||
SURREALDB_NAMESPACE: "test"
|
SURREALDB_NAMESPACE: "test"
|
||||||
OPENAI_API_KEY: "sk-key"
|
OPENAI_API_KEY: "sk-add-your-key"
|
||||||
DATA_DIR: "./data"
|
DATA_DIR: "./data"
|
||||||
HTTP_PORT: 3000
|
HTTP_PORT: 3000
|
||||||
RUST_LOG: "info"
|
RUST_LOG: "info"
|
||||||
|
RERANKING_ENABLED: false ## Change to true to enable reranking
|
||||||
depends_on:
|
depends_on:
|
||||||
- surrealdb
|
- surrealdb
|
||||||
networks:
|
networks:
|
||||||
@@ -31,7 +32,7 @@ services:
|
|||||||
- ./database:/database # Mounts a 'database' folder from your project directory
|
- ./database:/database # Mounts a 'database' folder from your project directory
|
||||||
command: >
|
command: >
|
||||||
start
|
start
|
||||||
--log debug
|
--log info
|
||||||
--user root_user
|
--user root_user
|
||||||
--pass root_password
|
--pass root_password
|
||||||
rocksdb:./database/database.db
|
rocksdb:./database/database.db
|
||||||
|
|||||||
Reference in New Issue
Block a user