Davide Panza commited on
Commit
5adda8d
·
verified ·
1 Parent(s): 1aaecac

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -12
Dockerfile CHANGED
@@ -1,39 +1,39 @@
1
  FROM python:3.9-slim
2
 
3
- # Set working directory to /app inside the container
4
  WORKDIR /app
5
 
6
  # Install system dependencies
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
9
  curl \
10
- software-properties-common \
11
  git \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Create the .streamlit directory to avoid permission errors
15
- RUN mkdir -p /app/.streamlit
16
 
17
- # Copy .streamlit config folder (including config.toml)
18
- COPY .streamlit/ .streamlit/
 
19
 
20
- # Copy app and config files
 
21
  COPY app/ ./
 
22
  COPY requirements.txt ./
23
 
24
  # Install Python dependencies
25
  RUN pip3 install -r requirements.txt
26
 
27
- # Expose port 8501 (Streamlit Spaces requirement)
28
- EXPOSE 8501
29
 
30
- # Set environment variables for Streamlit
31
  ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
32
  ENV STREAMLIT_SERVER_HEADLESS=true
33
  ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
34
 
35
- # Healthcheck endpoint for Spaces
36
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
37
 
38
- # Run Streamlit with port 8501 (DO NOT override port)
39
  ENTRYPOINT ["streamlit", "run", "main.py", "--server.address=0.0.0.0"]
 
1
  FROM python:3.9-slim
2
 
 
3
  WORKDIR /app
4
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
 
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Create directories
13
+ RUN mkdir -p /app/.streamlit /app/.cache
14
 
15
+ # Set cache environment variables
16
+ ENV TRANSFORMERS_CACHE=/app/.cache
17
+ ENV HF_HOME=/app/.cache
18
 
19
+ # Copy files
20
+ COPY .streamlit/ .streamlit/
21
  COPY app/ ./
22
+ COPY chromadb_model/ chromadb_model/
23
  COPY requirements.txt ./
24
 
25
  # Install Python dependencies
26
  RUN pip3 install -r requirements.txt
27
 
28
+ # Download NLTK data
29
+ RUN python -c "import nltk; nltk.download('punkt'); nltk.download('punkt_tab')"
30
 
31
+ # Streamlit configuration
32
  ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
33
  ENV STREAMLIT_SERVER_HEADLESS=true
34
  ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
35
 
36
+ EXPOSE 8501
37
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
38
 
 
39
  ENTRYPOINT ["streamlit", "run", "main.py", "--server.address=0.0.0.0"]