Speedofmastery commited on
Commit
ba755a9
·
verified ·
1 Parent(s): 9687a38

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +10 -52
  2. requirements.txt +0 -27
Dockerfile CHANGED
@@ -1,73 +1,31 @@
1
- # Production Docker image with all AI models and dependencies
2
- FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
3
 
4
- # Prevent interactive prompts
5
- ENV DEBIAN_FRONTEND=noninteractive \
6
- PYTHONUNBUFFERED=1 \
7
  GRADIO_SERVER_NAME=0.0.0.0 \
8
- GRADIO_SERVER_PORT=7860 \
9
- CUDA_HOME=/usr/local/cuda \
10
- HF_HOME=/home/user/.cache/huggingface
11
 
12
- # Install system dependencies
13
- RUN apt-get update && apt-get install -y \
14
- python3.10 \
15
- python3-pip \
16
- python3-dev \
17
- build-essential \
18
- git \
19
- curl \
20
- wget \
21
- ffmpeg \
22
- libsm6 \
23
- libxext6 \
24
- libxrender-dev \
25
- libgomp1 \
26
- && rm -rf /var/lib/apt/lists/* \
27
- && ln -s /usr/bin/python3.10 /usr/bin/python
28
-
29
- # Create user with ID 1000
30
  RUN useradd -m -u 1000 user
31
-
32
- # Switch to user
33
  USER user
34
 
35
  # Set paths
36
  ENV HOME=/home/user \
37
  PATH=/home/user/.local/bin:$PATH
38
 
39
- # Set working directory
40
  WORKDIR $HOME/app
41
 
42
- # Copy requirements first (for Docker layer caching)
43
  COPY --chown=user requirements.txt .
44
-
45
- # Install all Python dependencies
46
- RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
47
- pip install --no-cache-dir gradio && \
48
- pip install --no-cache-dir transformers accelerate diffusers && \
49
- pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 && \
50
- pip install --no-cache-dir opencv-python-headless pillow numpy scipy && \
51
- pip install --no-cache-dir huggingface_hub hf-transfer && \
52
- pip install --no-cache-dir sentencepiece protobuf && \
53
  pip install --no-cache-dir -r requirements.txt
54
 
55
- # Copy the complete application
56
  COPY --chown=user app.py .
57
 
58
- # Create necessary directories
59
- RUN mkdir -p $HOME/app/data $HOME/.cache/huggingface
60
-
61
- # Pre-download critical models (optional - uncomment if needed)
62
- # RUN python -c "from huggingface_hub import snapshot_download; \
63
- # snapshot_download('Qwen/Qwen2.5-7B-Instruct', cache_dir='$HF_HOME')"
64
-
65
  # Expose port
66
  EXPOSE 7860
67
 
68
- # Health check
69
- HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
70
- CMD curl -f http://localhost:7860/ || exit 1
71
-
72
- # Launch Gradio app
73
  CMD ["python", "app.py"]
 
1
+ # Simple production Docker with Python 3.10
2
+ FROM python:3.10
3
 
4
+ # Environment variables
5
+ ENV PYTHONUNBUFFERED=1 \
 
6
  GRADIO_SERVER_NAME=0.0.0.0 \
7
+ GRADIO_SERVER_PORT=7860
 
 
8
 
9
+ # Create user
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  RUN useradd -m -u 1000 user
 
 
11
  USER user
12
 
13
  # Set paths
14
  ENV HOME=/home/user \
15
  PATH=/home/user/.local/bin:$PATH
16
 
 
17
  WORKDIR $HOME/app
18
 
19
+ # Copy and install requirements
20
  COPY --chown=user requirements.txt .
21
+ RUN pip install --no-cache-dir --upgrade pip && \
 
 
 
 
 
 
 
 
22
  pip install --no-cache-dir -r requirements.txt
23
 
24
+ # Copy app
25
  COPY --chown=user app.py .
26
 
 
 
 
 
 
 
 
27
  # Expose port
28
  EXPOSE 7860
29
 
30
+ # Run app
 
 
 
 
31
  CMD ["python", "app.py"]
requirements.txt CHANGED
@@ -1,28 +1 @@
1
- # Core Gradio
2
  gradio>=4.0
3
-
4
- # AI/ML Frameworks
5
- transformers>=4.30.0
6
- accelerate
7
- diffusers
8
- sentencepiece
9
- protobuf
10
-
11
- # Image Processing
12
- opencv-python-headless
13
- pillow
14
- imageio
15
-
16
- # Audio Processing
17
- librosa
18
- soundfile
19
-
20
- # Data Science
21
- numpy
22
- pandas
23
- scipy
24
-
25
- # Utilities
26
- huggingface_hub
27
- requests
28
- aiohttp
 
 
1
  gradio>=4.0