-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (44 loc) · 2.12 KB
/
Dockerfile
File metadata and controls
60 lines (44 loc) · 2.12 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
54
55
56
57
58
59
60
# ──────────────────────────────────────────────
# Stage 1 — Build feather_db wheel
# ──────────────────────────────────────────────
FROM python:3.11-slim AS builder
WORKDIR /build
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
COPY . /build/feather_source
WORKDIR /build/feather_source
RUN pip install --upgrade pip setuptools wheel pybind11 build && \
pip wheel --no-build-isolation --no-deps -w dist .
# ──────────────────────────────────────────────
# Stage 2 — Runtime image
# ──────────────────────────────────────────────
FROM python:3.11-slim AS runtime
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Install feather_db from wheel built in stage 1
COPY --from=builder /build/feather_source/dist/*.whl /tmp/wheels/
RUN pip install --no-cache-dir /tmp/wheels/*.whl numpy && rm -rf /tmp/wheels
# Install API dependencies
COPY feather-api/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Install dashboard dependencies
RUN pip install --no-cache-dir gradio==5.9.1 plotly requests
# Copy API source + dashboard
COPY feather-api/app /app/app
COPY feather-api/dashboard.py /app/dashboard.py
# Data directory (override with -v /host/data:/data)
RUN mkdir -p /data
VOLUME ["/data"]
# Environment defaults
ENV FEATHER_DATA_DIR=/data
ENV FEATHER_DB_DIM=768
ENV FEATHER_API_KEY=""
# Health-check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]