FROM timescale/timescaledb-ha:pg17 USER root # Install Python 3, pip, and venv RUN apt-get update && \ apt-get install -y python3 python3-pip python3-venv curl nginx && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Setup directories for Hugging Face Spaces (UID 1000) RUN mkdir -p /app && \ chown -R 1000:1000 /app # Switch to HF user USER 1000 WORKDIR /app # Create virtual environment and install dependencies RUN python3 -m venv /app/venv ENV PATH="/app/venv/bin:$PATH" COPY requirements.txt /app/ RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY app.py run.sh create_sqlite_dump.py /app/ # Expose port 7860 (Hugging Face default) EXPOSE 7860 # Execute the supervisor script CMD ["bash", "/app/run.sh"]