File size: 1,192 Bytes
9995fd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7467c5d
9995fd4
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.9-slim

WORKDIR /app

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

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Environment variables for Streamlit
ENV STREAMLIT_SERVER_PORT=7860
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_SERVER_ENABLE_CORS=true

# Environment variables for API
ENV API_HOST=0.0.0.0
ENV API_PORT=8000

# Set up external API URL for Hugging Face Spaces
# This will be overridden in deployment
ENV EXTERNAL_API_URL=""

# Copy all application files
COPY . .

# Create an empty .env file if it doesn't exist
RUN touch .env

# Create SQLite database directory with proper permissions
RUN mkdir -p /app/data && chmod -R 777 /app/data
ENV SQLITE_DB_PATH=/app/data/profiles.db

# Set Streamlit configuration to enable CORS for the API server
RUN mkdir -p /app/.streamlit
RUN echo "[server]\nenableCORS = true\nenableCORSForAllOrigins = true" > /app/.streamlit/config.toml

# Expose ports
EXPOSE 7860 8000

# Run both services
CMD ["python", "run_combined.py"]