File size: 1,157 Bytes
34727e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7edb895
 
343fd3b
 
34727e8
 
 
 
 
 
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
# --- Stage 1: Build frontend ---
FROM oven/bun:1 AS frontend-build
WORKDIR /app/frontend
COPY frontend/package.json frontend/bun.lock* ./
RUN bun install --frozen-lockfile
COPY frontend/ .
RUN bun run build

# --- Stage 2: Python runtime ---
FROM python:3.11-slim

# System deps for torch/PIL
RUN apt-get update && \
    apt-get install -y --no-install-recommends git && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Python deps with pip (uv not available in slim image)
COPY pyproject.toml .
RUN pip install --no-cache-dir ".[browser]" 2>/dev/null || pip install --no-cache-dir . && \
    pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu

# Copy app code
COPY taste/ taste/
COPY backend/ backend/
COPY cli.py .

# Copy built frontend
COPY --from=frontend-build /app/frontend/dist frontend/dist

# Data directory — mounted from HF bucket at /data
ENV TASTE_DATA_DIR=/data
ENV HF_HOME=/data/cache/huggingface
ENV TRANSFORMERS_CACHE=/data/cache/huggingface

# HF Spaces expects port 7860
ENV PORT=7860
EXPOSE 7860

CMD ["python", "-m", "uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "7860"]