File size: 1,629 Bytes
e1459e5
730c823
 
e1459e5
730c823
 
e1459e5
c7722f4
 
 
 
 
 
730c823
e1459e5
730c823
a47c7ab
e1459e5
730c823
 
e1459e5
 
 
d2f6bc8
 
 
 
 
e8d257c
d2f6bc8
 
 
 
 
e8d257c
d2f6bc8
 
 
 
730c823
 
e1459e5
730c823
 
e1459e5
a47c7ab
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
# Use a slim Python image as a base
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Install system dependencies needed for some Python packages
# RUN apt-get update && apt-get install -y \
#     build-essential \
#     curl \
#     software-properties-common \
#     git \
#     && rm -rf /var/lib/apt/lists/*

# Copy the requirements file first to leverage Docker cache
COPY requirements.txt ./

# Install Python dependencies
RUN pip3 install -r requirements.txt

# This will copy streamlit_app.py, agents.py, the tools/ folder, etc.
COPY . .

# --- START: PERMISSION FIXES FOR HUGGING FACE SPACES ---

# 1. Create the directories your application needs to write to at runtime.
#    Using /data is a common and clean convention for persistent/writable data.
#    The -p flag ensures parent directories are created if needed.
RUN mkdir -p /app/vectordb/lancedb 

# 2. Change the ownership of these new data directories to be globally writable.
#    The 777 permission is broad, but very effective in hosted environments where
#    you don't know which user ID (e.g., uid=1000) will run the process.
#    This command says "any user can read, write, and execute in these folders".
RUN chmod -R 777 /app/vectordb

# --- END: PERMISSION FIXES ---

# Expose the port Streamlit will run on. Your file uses 8501.
EXPOSE 8501

# Set up a health check to see if the app is running
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

# Define the command to run when the container starts
ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]