d-e-e-k-11 commited on
Commit
b187e4d
·
verified ·
1 Parent(s): ca72ed3

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -9
Dockerfile CHANGED
@@ -1,28 +1,32 @@
1
  # Use official Python image
2
  FROM python:3.10-slim
3
 
 
 
 
 
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies for OpenCV
8
- RUN apt-get update && apt-get install -y \
9
  libgl1-mesa-glx \
10
  libglib2.0-0 \
11
- && rm -rf /var/lib/apt/lists/*
12
 
13
  # Copy requirements and install dependencies
14
  COPY requirements.txt .
15
  RUN pip install --no-cache-dir -r requirements.txt
16
- RUN pip install --no-cache-dir gunicorn
17
 
18
  # Copy application code
19
  COPY . .
20
 
21
- # Create uploads directory
22
- RUN mkdir -p static/uploads && chmod 777 static/uploads
23
 
24
- # Expose port 7860
25
  EXPOSE 7860
26
 
27
- # Run the application with gunicorn
28
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
 
1
  # Use official Python image
2
  FROM python:3.10-slim
3
 
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE=1 \
6
+ PYTHONUNBUFFERED=1 \
7
+ PORT=7860
8
+
9
  # Set working directory
10
  WORKDIR /app
11
 
12
+ # Install system dependencies for OpenCV and cleaning up in one layer
13
+ RUN apt-get update && apt-get install -y --no-install-recommends \
14
  libgl1-mesa-glx \
15
  libglib2.0-0 \
16
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
17
 
18
  # Copy requirements and install dependencies
19
  COPY requirements.txt .
20
  RUN pip install --no-cache-dir -r requirements.txt
 
21
 
22
  # Copy application code
23
  COPY . .
24
 
25
+ # Ensure static directories exist with correct permissions
26
+ RUN mkdir -p static/uploads && chmod -R 777 static
27
 
28
+ # Expose port
29
  EXPOSE 7860
30
 
31
+ # Run the application
32
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "8", "--timeout", "0", "app:app"]