deedrop1140 commited on
Commit
e5913f8
·
verified ·
1 Parent(s): 08aee66

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -14
Dockerfile CHANGED
@@ -1,32 +1,31 @@
1
- # Use official Python base image
2
  FROM python:3.10-slim
3
 
4
- # Avoid Python buffering
 
5
  ENV PYTHONUNBUFFERED=1
6
 
7
- # Set work directory
8
  WORKDIR /app
9
 
10
  # Install system dependencies
11
  RUN apt-get update && apt-get install -y \
12
  build-essential \
 
13
  git \
14
- curl \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
- # Copy requirements.txt and install
18
  COPY requirements.txt .
19
- RUN pip install --upgrade pip && pip install -r requirements.txt
20
 
21
- # Copy project files
 
 
 
22
  COPY . .
23
 
24
- # Expose port (Hugging Face expects 7860 by default, but Flask usually runs 5000)
25
  EXPOSE 7860
26
 
27
- # Set environment variable for Flask
28
- ENV PORT=7860
29
- ENV FLASK_APP=app.py
30
-
31
- # Run Flask
32
- CMD ["flask", "run", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use lightweight Python base image
2
  FROM python:3.10-slim
3
 
4
+ # Prevents Python from writing .pyc files
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
 
8
+ # Set working directory
9
  WORKDIR /app
10
 
11
  # Install system dependencies
12
  RUN apt-get update && apt-get install -y \
13
  build-essential \
14
+ python3-dev \
15
  git \
 
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # Copy requirements first (for caching)
19
  COPY requirements.txt .
 
20
 
21
+ # Install Python dependencies
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Copy the app code
25
  COPY . .
26
 
27
+ # Expose port (Hugging Face expects 7860 for Gradio/Flask)
28
  EXPOSE 7860
29
 
30
+ # Run Flask app
31
+ CMD ["python", "app.py"]