yukee1992 commited on
Commit
ba74310
·
verified ·
1 Parent(s): 05beda1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -5
Dockerfile CHANGED
@@ -6,22 +6,30 @@ WORKDIR /app
6
  RUN apt-get update && apt-get install -y \
7
  libsndfile1 \
8
  curl \
9
- git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Install latest transformers from source
13
- RUN pip install --no-cache-dir git+https://github.com/huggingface/transformers.git
14
 
15
- # Copy requirements
16
  COPY requirements.txt .
 
 
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
  # Copy application code
20
  COPY app.py .
21
 
22
- # Create non-root user
23
  RUN useradd -m -u 1000 user
24
  USER user
25
 
 
26
  EXPOSE 7860
 
 
 
 
 
 
27
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
6
  RUN apt-get update && apt-get install -y \
7
  libsndfile1 \
8
  curl \
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Create cache directory for models
12
+ RUN mkdir -p /tmp/models && chmod 777 /tmp/models
13
 
14
+ # Copy requirements first for better caching
15
  COPY requirements.txt .
16
+
17
+ # Install Python dependencies with newer versions
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
  # Copy application code
21
  COPY app.py .
22
 
23
+ # Create non-root user for security
24
  RUN useradd -m -u 1000 user
25
  USER user
26
 
27
+ # Expose port (Hugging Face uses 7860)
28
  EXPOSE 7860
29
+
30
+ # Health check
31
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
32
+ CMD curl -f http://localhost:7860/health || exit 1
33
+
34
+ # Run the application
35
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]