MahekTrivedi commited on
Commit
c76bfc7
·
verified ·
1 Parent(s): 7cca18c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -1
Dockerfile CHANGED
@@ -1,6 +1,11 @@
1
  # Use a Python base image (adjust version as needed, 3.9 is fine as per your logs)
2
  FROM python:3.9-slim
3
 
 
 
 
 
 
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
@@ -20,8 +25,14 @@ RUN apt-get update && apt-get install -y \
20
  COPY requirements.txt ./
21
  RUN pip3 install --no-cache-dir -r requirements.txt
22
 
 
 
 
 
 
 
23
  # Copy the Streamlit configuration directory
24
- # This is crucial for resolving the PermissionError
25
  COPY .streamlit/ .streamlit/
26
 
27
  # Copy your application source code
 
1
  # Use a Python base image (adjust version as needed, 3.9 is fine as per your logs)
2
  FROM python:3.9-slim
3
 
4
+ # Set environment variables for cache directories to a writable location
5
+ # This resolves PermissionError for /.cache (Hugging Face) and /.config (Matplotlib)
6
+ ENV HF_HOME="/tmp/hf_cache"
7
+ ENV MPLCONFIGDIR="/tmp/matplotlib"
8
+
9
  # Set the working directory in the container
10
  WORKDIR /app
11
 
 
25
  COPY requirements.txt ./
26
  RUN pip3 install --no-cache-dir -r requirements.txt
27
 
28
+ # Create the /tmp/hf_cache and /tmp/matplotlib directories if they don't exist
29
+ # and ensure they are writable by the default user.
30
+ # The ENV variables above will direct the libraries to use these paths,
31
+ # but it's good practice to ensure the directories exist and have correct permissions.
32
+ RUN mkdir -p /tmp/hf_cache /tmp/matplotlib && chmod -R 777 /tmp/hf_cache /tmp/matplotlib
33
+
34
  # Copy the Streamlit configuration directory
35
+ # This is crucial for resolving the PermissionError for Streamlit's own config
36
  COPY .streamlit/ .streamlit/
37
 
38
  # Copy your application source code