logeswari commited on
Commit
f943cab
·
1 Parent(s): 9eff599
Files changed (1) hide show
  1. Dockerfile +18 -9
Dockerfile CHANGED
@@ -1,20 +1,29 @@
1
- # Use a base image
2
- FROM python:3.9-slim
3
 
4
  # Set the working directory
5
  WORKDIR /app
6
 
7
- # Copy project files
8
- COPY . /app
 
9
 
10
- # Ensure the logs directory exists and is writable
11
- RUN mkdir -p logs && chmod -R 777 logs
 
 
 
 
12
 
13
  # Install dependencies
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
- # Expose the application port
 
 
 
 
17
  EXPOSE 7860
18
 
19
- # Command to run the application
20
- CMD ["uvicorn", "app.py", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use the official Python image from Docker Hub
2
+ FROM python:3.11-slim
3
 
4
  # Set the working directory
5
  WORKDIR /app
6
 
7
+ # Copy the application files
8
+ COPY app.py /app/
9
+ COPY requirements.txt /app/
10
 
11
+ # Create a writable cache directory for Hugging Face
12
+ ENV HF_HOME=/app/hf_cache
13
+ RUN mkdir -p /app/hf_cache
14
+
15
+ # Set permissions for the cache directory
16
+ RUN chmod -R 777 /app/hf_cache
17
 
18
  # Install dependencies
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Create a non-root user and switch to it
22
+ RUN useradd -m appuser
23
+ USER appuser
24
+
25
+ # Expose the Streamlit port
26
  EXPOSE 7860
27
 
28
+ # Run the Streamlit app
29
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]