diff --git a/Cargo.toml b/Cargo.toml index 0986c73..372620c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ axum = { version = "0.8.4", features = ["ws"] } dotenv = "0.15.0" futures = "0.3.31" lazy_static = "1.5.0" -reqwest = { version = "0.12.20", features = ["json", "rustls-tls"] } +reqwest = { version = "0.12.20", default-features = false, features = ["json", "rustls-tls"] } serde = { version = "1.0.219", features = ["derive"] } serde_json = "1.0.140" tokio = { version = "1.45.1", features = ["full"] } diff --git a/Dockerfile b/Dockerfile index 195cc8a..a3555bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,21 @@ -FROM rust:latest AS builder +FROM rust:alpine AS builder + +RUN apk add -q --no-cache build-base curl + WORKDIR /app -RUN apt update && apt install -y musl-tools \ - pkg-config \ - libssl-dev \ - openssl -RUN rustup target add x86_64-unknown-linux-gnu +RUN rustup target add x86_64-unknown-linux-musl COPY . . -# PKG_CONFIG_PATH VAR TESTING -ENV PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc -ARG PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc - -RUN cargo build --release --target=x86_64-unknown-linux-gnu +RUN cargo build --release --target=x86_64-unknown-linux-musl FROM alpine:latest WORKDIR /app -COPY --from=builder /app/target/x86_64-unknown-linux-gnu/release/ml-api /app/ml-api -RUN ls /app +COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/ml-api /app/ml-api RUN apk add --no-cache ca-certificates -EXPOSE 5134 +EXPOSE 5134/tcp -ENTRYPOINT ["/app/ml-api"] \ No newline at end of file +ENTRYPOINT ["/app/ml-api"] diff --git a/docker-compose.yml b/docker-compose.yml index 6242df0..dfe390d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: ollama-api: container_name: ollama-api - image: ollama-api:dev + image: ollama-api:musl-dev networks: - ollama-api-net environment: @@ -10,7 +10,7 @@ services: - NOXIS_LOG_LEVEL=TRACE - ML_TARGET_URL=http://192.168.231.89:11434/api/generate - ML_MODEL_NAME=kis-test - - ML_REQUEST_TIMEOUT=10 + - ML_REQUEST_TIMEOUT=10 - ML_LOG_LEVEL=TRACE - ML_API_PORT=5134 ports: diff --git a/src/endpoints.rs b/src/endpoints.rs index 799e438..2ece019 100644 --- a/src/endpoints.rs +++ b/src/endpoints.rs @@ -9,12 +9,6 @@ use std::sync::Arc; type Config = Arc; -pub mod openapi { - use super::{IntoResponse, StatusCode}; - - pub async fn swagger() -> impl IntoResponse { (StatusCode::NOT_IMPLEMENTED, "still in development ...") } -} - pub mod rest { use tracing::trace; use super::{IntoResponse, StatusCode, InputMetric, Json, Config, State};