tao-shen commited on
Commit
f57429c
·
verified ·
1 Parent(s): 9f06413

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -7
Dockerfile CHANGED
@@ -1,19 +1,27 @@
1
- FROM python:3.9-slim
 
2
 
3
- # Set the working directory to /app (this was /workspace before, causing the runtime error)
4
  WORKDIR /app
5
 
6
- # Copy the requirements file
 
 
 
7
  COPY requirements.txt .
8
 
9
- # Install dependencies
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
- # Copy the application code
13
  COPY . .
14
 
15
- # Expose the port
 
 
 
 
16
  EXPOSE 7860
17
 
18
  # Run the application
19
- CMD ["streamlit", "run", "app.py"]
 
1
+ # Use lightweight Python base image
2
+ FROM python:3.10-slim
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies safely
8
+ RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Copy requirements first for better caching
11
  COPY requirements.txt .
12
 
13
+ # Install Python packages
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # Copy application code
17
  COPY . .
18
 
19
+ # Set environment variables for robust startup
20
+ ENV PYTHONUNBUFFERED=1
21
+ ENV GRADIO_SERVER_NAME="0.0.0.0"
22
+
23
+ # Expose port
24
  EXPOSE 7860
25
 
26
  # Run the application
27
+ CMD ["python", "app.py"]