tsrivallabh commited on
Commit
53c97fd
·
verified ·
1 Parent(s): 0d03aec

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -28
Dockerfile CHANGED
@@ -1,28 +1,35 @@
1
-
2
-
3
- # Use an official Python runtime as a parent image
4
- FROM python:3.11-slim
5
-
6
-
7
- # Set the working directory in the container
8
- WORKDIR /app
9
-
10
- ENV HF_HOME=/data/hf_cache
11
- ENV TRANSFORMERS_CACHE=/data/hf_cache/transformers
12
- ENV HF_DATASETS_CACHE=/data/hf_cache/datasets
13
- ENV HF_HUB_CACHE=/data/hf_cache/hub
14
-
15
- RUN mkdir -p /data/hf_cache/transformers /data/hf_cache/datasets /data/hf_cache/hub && chmod -R 777 /data/hf_cache
16
-
17
- # Copy requirements.txt and install dependencies
18
- COPY requirements.txt .
19
- RUN pip install --no-cache-dir -r requirements.txt
20
-
21
- # Copy the rest of your app's code
22
- COPY . .
23
-
24
- # Expose the port Streamlit runs on
25
- EXPOSE 8501
26
-
27
- # Run Streamlit
28
- CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.11-slim
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /app
6
+
7
+ # Set environment variables for HF cache
8
+ ENV HF_HOME=/data/hf_cache
9
+ ENV TRANSFORMERS_CACHE=/data/hf_cache/transformers
10
+ ENV HF_DATASETS_CACHE=/data/hf_cache/datasets
11
+ ENV HF_HUB_CACHE=/data/hf_cache/hub
12
+
13
+ # Create cache directories and give permissions
14
+ RUN mkdir -p /data/hf_cache/transformers /data/hf_cache/datasets /data/hf_cache/hub \
15
+ && chmod -R 777 /data/hf_cache
16
+
17
+ # Create .streamlit directory for Streamlit configs
18
+ RUN mkdir -p /app/.streamlit
19
+
20
+ # Copy requirements and install dependencies
21
+ COPY requirements.txt .
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Copy the rest of your app code
25
+ COPY . .
26
+
27
+ # If you have a .streamlit/config.toml, copy it explicitly
28
+ # This prevents the PermissionError when Streamlit tries to write defaults
29
+ COPY .streamlit/config.toml /app/.streamlit/
30
+
31
+ # Expose the port Streamlit runs on
32
+ EXPOSE 8501
33
+
34
+ # Run Streamlit
35
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]