Speedofmastery commited on
Commit
04e84b3
·
verified ·
1 Parent(s): 2d5fe14

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -30
Dockerfile CHANGED
@@ -1,23 +1,11 @@
1
- # Use NVIDIA CUDA base image for GPU support on HuggingFace Spaces
2
- FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
3
 
4
  # Set environment variables
5
- ENV DEBIAN_FRONTEND=noninteractive \
6
- PYTHONUNBUFFERED=1 \
7
  GRADIO_SERVER_NAME=0.0.0.0 \
8
  GRADIO_SERVER_PORT=7860
9
 
10
- # Install system dependencies
11
- RUN apt-get update && apt-get install -y \
12
- python3.10 \
13
- python3-pip \
14
- git \
15
- curl \
16
- && rm -rf /var/lib/apt/lists/*
17
-
18
- # Create symbolic link for python
19
- RUN ln -s /usr/bin/python3.10 /usr/bin/python
20
-
21
  # Set up user with ID 1000 (required by HuggingFace Spaces)
22
  RUN useradd -m -u 1000 user
23
 
@@ -31,27 +19,17 @@ ENV HOME=/home/user \
31
  # Set working directory
32
  WORKDIR $HOME/app
33
 
34
- # Upgrade pip
35
- RUN pip3 install --no-cache-dir --upgrade pip
36
-
37
- # Copy requirements and install (fix NumPy version first)
38
  COPY --chown=user requirements.txt .
39
- RUN pip3 install --no-cache-dir "numpy<2" && \
40
- pip3 install --no-cache-dir -r requirements.txt
 
41
 
42
  # Copy application files
43
  COPY --chown=user app.py .
44
- COPY --chown=user README.md .
45
-
46
- # Create data directory for persistent storage
47
- RUN mkdir -p $HOME/app/data
48
 
49
  # Expose Gradio port
50
  EXPOSE 7860
51
 
52
- # Health check
53
- HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
54
- CMD curl -f http://localhost:7860/ || exit 1
55
-
56
  # Run the Gradio application
57
- CMD ["python3", "app.py"]
 
1
+ # Simple Python image for fast builds
2
+ FROM python:3.10-slim
3
 
4
  # Set environment variables
5
+ ENV PYTHONUNBUFFERED=1 \
 
6
  GRADIO_SERVER_NAME=0.0.0.0 \
7
  GRADIO_SERVER_PORT=7860
8
 
 
 
 
 
 
 
 
 
 
 
 
9
  # Set up user with ID 1000 (required by HuggingFace Spaces)
10
  RUN useradd -m -u 1000 user
11
 
 
19
  # Set working directory
20
  WORKDIR $HOME/app
21
 
22
+ # Copy requirements and install
 
 
 
23
  COPY --chown=user requirements.txt .
24
+ RUN pip install --no-cache-dir --upgrade pip && \
25
+ pip install --no-cache-dir "numpy<2" && \
26
+ pip install --no-cache-dir -r requirements.txt
27
 
28
  # Copy application files
29
  COPY --chown=user app.py .
 
 
 
 
30
 
31
  # Expose Gradio port
32
  EXPOSE 7860
33
 
 
 
 
 
34
  # Run the Gradio application
35
+ CMD ["python", "app.py"]