File size: 927 Bytes
effe6e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use a base image with Python
FROM python:3.10-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*

# Install Node.js (for serving frontend if needed)
RUN apt-get install -y curl && \
    curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
    apt-get install -y nodejs

# Copy and install Python dependencies
COPY requirements.txt ./
RUN pip install --upgrade pip && pip install -r requirements.txt

# Copy all files
COPY . .

# Set environment variable for Together API key (set via HF secrets)
ENV TOGETHER_API_KEY=${TOGETHER_API_KEY}

# Build React frontend
RUN cd ./ && npm install && npm run build

# Use uvicorn to launch FastAPI
EXPOSE 7860
CMD ["uvicorn", "api_service:app", "--host", "0.0.0.0", "--port", "7860"]