-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (27 loc) · 1.16 KB
/
Dockerfile
File metadata and controls
35 lines (27 loc) · 1.16 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
# FrothIQ FastAPI inference container.
#
# Build: docker build -t frothiq-api .
# Run: docker run -p 8000:8000 -v $(pwd)/mlruns:/app/mlruns frothiq-api
#
# Uses python:3.11-slim for a small image. PyTorch is excluded from the runtime
# install because the FastAPI service only needs LightGBM at inference. If you
# also want to serve the LSTM, change `--extra-index-url` to install torch CPU.
FROM python:3.11-slim AS base
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /app
# System deps for LightGBM and pyarrow.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential libgomp1 \
&& rm -rf /var/lib/apt/lists/*
COPY pyproject.toml LICENSE README.md ./
COPY src ./src
# Install only inference deps. We exclude pyspark, jupyter, etc. to keep the image small.
RUN pip install \
"fastapi>=0.110" "uvicorn[standard]>=0.27" "pydantic>=2" \
"pandas>=2.2" "numpy>=1.26" "scipy>=1.13" "scikit-learn>=1.5" \
"lightgbm>=4.3" "mlflow>=2.14" "joblib" \
&& pip install --no-deps -e .
EXPOSE 8000
CMD ["uvicorn", "frothiq.serving.api:app", "--host", "0.0.0.0", "--port", "8000"]