Rajhuggingface4253 commited on
Commit
7123400
·
verified ·
1 Parent(s): ddd927d

Rename Dockerfile to dockerfile

Browse files
Files changed (2) hide show
  1. Dockerfile +0 -64
  2. dockerfile +29 -0
Dockerfile DELETED
@@ -1,64 +0,0 @@
1
- # [file name]: Dockerfile
2
- FROM python:3.10-slim
3
-
4
- # Set environment variables
5
- ENV DEBIAN_FRONTEND=noninteractive
6
- ENV HF_HOME=/app/cache
7
- ENV HUGGINGFACE_HUB_CACHE=/app/cache
8
- ENV NUMBA_CACHE_DIR=/tmp/numba_cache
9
- ENV HF_HUB_DISABLE_LOCKING=1
10
- ENV PYTHONUNBUFFERED=1
11
- ENV PYTHONDONTWRITEBYTECODE=1
12
-
13
- WORKDIR /app
14
-
15
- # Install system dependencies
16
- RUN apt-get update && apt-get install -y --no-install-recommends \
17
- espeak-ng \
18
- libsndfile1 \
19
- git \
20
- ffmpeg \
21
- curl \
22
- && rm -rf /var/lib/apt/lists/*
23
-
24
- # Create a non-root user with a home directory
25
- RUN useradd -m -u 1000 appuser && \
26
- mkdir -p /app/cache /tmp/numba_cache /app/temp_audio && \
27
- chown -R appuser:appuser /app /tmp/numba_cache
28
-
29
- # Switch to non-root user for Python package installation
30
- USER appuser
31
-
32
- # Set home directory for the user (important for pip cache)
33
- ENV HOME=/home/appuser
34
- ENV PATH="/home/appuser/.local/bin:${PATH}"
35
-
36
- # Copy requirements first (for better caching)
37
- COPY --chown=appuser:appuser requirements.txt .
38
-
39
- # Install Python dependencies as non-root user
40
- RUN pip install --user --no-cache-dir --upgrade pip && \
41
- pip install --user --no-cache-dir -r requirements.txt
42
-
43
- # Clone neutts-air (shallow clone to save space)
44
- RUN if [ ! -d "neutts-air" ]; then \
45
- echo "Cloning neutts-air (shallow clone)..."; \
46
- git clone --depth 1 https://github.com/neuphonic/neutts-air.git; \
47
- fi
48
-
49
- # Copy application code
50
- COPY --chown=appuser:appuser app.py .
51
- COPY --chown=appuser:appuser neutts_wrapper.py .
52
- COPY --chown=appuser:appuser preload_model.py .
53
-
54
- # Pre-load models during build
55
- RUN python preload_model.py
56
-
57
- EXPOSE 7860
58
-
59
- # Health check
60
- HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
61
- CMD curl -f http://localhost:7860/health || exit 1
62
-
63
- # Command to run the application
64
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Environment variables
6
+ ENV HF_HOME=/app/cache
7
+ ENV HUGGINGFACE_HUB_CACHE=/app/cache
8
+ ENV HF_HUB_DISABLE_LOCKING=1
9
+
10
+ # Install ONLY essential system deps
11
+ RUN apt-get update && apt-get install -y --no-install-recommends \
12
+ espeak-ng libsndfile1 git curl \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Copy requirements FIRST for caching
16
+ COPY requirements.txt .
17
+
18
+ # Install CPU-only PyTorch and dependencies
19
+ RUN pip install --no-cache-dir -r requirements.txt
20
+
21
+ # Clone neutts-air
22
+ RUN git clone --depth 1 https://github.com/neuphonic/neutts-air.git
23
+
24
+ # Copy ONLY the essential app file
25
+ COPY app.py .
26
+
27
+ EXPOSE 7860
28
+
29
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]