File size: 873 Bytes
5e78145 27de439 | 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 | # Use official Python 3.9 slim image as base
FROM python:3.9-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
sqlite3 \
supervisor \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY frontend.py .
COPY backend.py .
COPY init_db.py .
COPY static/ static/
COPY supervisord.conf .
# Create logs directory and set permissions
RUN mkdir -p /app/logs && chmod -R 777 /app/logs
# Initialize SQLite database and set permissions
RUN python init_db.py && chmod 666 /app/crime_records.db
# Expose port 8501 for Streamlit (Hugging Face Spaces default)
EXPOSE 8501
# Run supervisord to manage Flask and Streamlit
CMD ["supervisord", "-c", "supervisord.conf"] |