-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (44 loc) · 1.25 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (44 loc) · 1.25 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Multi-stage production container for FinTech Transaction Intelligence API
FROM python:3.11-slim as runtime
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PYTHONPATH=/app/src
# Set working directory
WORKDIR /app
# Install system dependencies (build-essential, libgomp for OpenMP/LightGBM)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgomp1 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency requirements
COPY pyproject.toml /app/
# Install python packages
RUN pip install --no-cache-dir \
fastapi \
uvicorn[standard] \
gunicorn \
pydantic \
polars \
numpy \
lightgbm \
xgboost \
catboost \
onnxruntime \
onnxmltools \
scikit-learn \
pyyaml
# Copy application source code and configuration
COPY src /app/src
COPY configs /app/configs
COPY artifacts /app/artifacts
COPY main.py /app/
# Expose port 8000
EXPOSE 8000
# Health check endpoint
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Start Gunicorn master with Uvicorn ASGI workers
CMD ["gunicorn", "-c", "configs/gunicorn_conf.py", "api.main:app"]