Spaces:
Running
Running
| # Base image | |
| FROM ubuntu:22.04 | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| python3 \ | |
| python3-pip \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Ollama | |
| RUN curl -fsSL https://ollama.com/install.sh | sh | |
| # Copy necessary files | |
| COPY requirements.txt . | |
| COPY src/ src/ | |
| COPY run_saturday_analysis.py . | |
| COPY entrypoint.sh . | |
| # Copy other possible dependencies if they are at root like setup.py or local modules | |
| # For now, assuming src/ structure covers most imports, but let's be safe | |
| COPY . . | |
| # Install Python dependencies | |
| RUN pip3 install --no-cache-dir -r requirements.txt | |
| # Set permissions for entrypoint (must be done as root) | |
| RUN chmod +x entrypoint.sh | |
| # Create a non-root user (Hugging Face Spaces runs as user 1000) | |
| RUN useradd -m -u 1000 user | |
| # Sets permissions for the app directory so the user can write (e.g. database dir) | |
| RUN chown -R user:user /app | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Set entrypoint | |
| ENTRYPOINT ["./entrypoint.sh"] | |