Spaces:
Running
Running
Update Dockerfile and README.md for improved directory permissions and deployment instructions
7467c5d
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"] | |