File size: 1,107 Bytes
3fe0726
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4ede1d
 
 
3fe0726
 
a3c7ac0
 
 
 
3fe0726
 
 
 
 
 
 
 
 
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
48
# 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"]