File size: 766 Bytes
e2dbb45
 
 
 
2f80103
41b88b5
 
2f80103
 
 
41b88b5
e2dbb45
 
 
 
 
 
 
a7f1017
e2dbb45
41b88b5
e2dbb45
 
 
 
2f80103
e2dbb45
 
 
 
 
 
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
FROM python:3.9-slim

WORKDIR /app

# Create user-writable cache and temp directories
ENV HF_HOME=/app/.cache
ENV TORCH_HOME=/app/.cache/torch
ENV TMPDIR=/app/tmp
RUN mkdir -p /app/.cache/huggingface /app/.cache/torch /app/tmp
RUN chmod -R 777 /app/.cache /app/tmp

# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application
COPY app/ ./app/

# Create required directories with proper permissions
RUN mkdir -p uploads models
RUN chmod -R 777 uploads models

# Set environment variables
ENV PYTHONPATH=/app
ENV PORT=7860
ENV PYTHONUNBUFFERED=1

# Expose the port
EXPOSE 7860

# Start the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]