Rajhuggingface4253 commited on
Commit
c05862d
·
verified ·
1 Parent(s): 9948e87

Rename Dockerfile to dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile → dockerfile +14 -16
Dockerfile → dockerfile RENAMED
@@ -9,9 +9,6 @@ ENV HF_HOME=/app/cache
9
  ENV NUMBA_CACHE_DIR=/app/cache/numba_cache
10
  ENV CUDA_VISIBLE_DEVICES=""
11
 
12
- # Ensure user-local bin is on PATH so scripts installed into ~/.local/bin are discoverable
13
- ENV PATH="/home/appuser/.local/bin:${PATH}"
14
-
15
  # Install essential system dependencies
16
  RUN apt-get update && apt-get install -y --no-install-recommends \
17
  git \
@@ -20,7 +17,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
20
  libsndfile1 \
21
  ffmpeg \
22
  curl \
23
- ca-certificates \
24
  && rm -rf /var/lib/apt/lists/*
25
 
26
  # Set the working directory
@@ -30,23 +26,25 @@ WORKDIR /app
30
  # Create a new user 'appuser' with UID 1000 and create their home directory
31
  RUN useradd --create-home --uid 1000 appuser
32
 
33
- # Switch to root to create dirs and set permissions
34
- USER root
35
- RUN mkdir -p /app/cache && chown -R appuser:appuser /app /app/cache
36
  USER appuser
37
 
38
- # Ensure pip is up-to-date for wheel installs
39
- RUN python -m pip install --upgrade pip
40
 
41
- # Install CPU-only PyTorch and torchaudio from official index (explicit CPU builds)
42
- RUN pip install --no-cache-dir "torch==2.2.0+cpu" "torchaudio==2.2.0+cpu" -f https://download.pytorch.org/whl/torch_stable.html
 
 
 
 
43
 
44
- # Copy requirements and install remaining dependencies as non-root user
45
  COPY --chown=appuser:appuser requirements.txt .
46
  RUN pip install --no-cache-dir -r requirements.txt
47
 
48
- # Clone the NeuTTS Air repository (shallow to save space)
49
- RUN git clone --depth 1 https://github.com/neuphonic/neutts-air.git
50
 
51
  # Copy the application code
52
  COPY --chown=appuser:appuser app.py .
@@ -58,5 +56,5 @@ EXPOSE 7860
58
  HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
59
  CMD curl -f http://localhost:7860/health || exit 1
60
 
61
- # Use python -m uvicorn to avoid relying on console script being on PATH
62
- CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
9
  ENV NUMBA_CACHE_DIR=/app/cache/numba_cache
10
  ENV CUDA_VISIBLE_DEVICES=""
11
 
 
 
 
12
  # Install essential system dependencies
13
  RUN apt-get update && apt-get install -y --no-install-recommends \
14
  git \
 
17
  libsndfile1 \
18
  ffmpeg \
19
  curl \
 
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
  # Set the working directory
 
26
  # Create a new user 'appuser' with UID 1000 and create their home directory
27
  RUN useradd --create-home --uid 1000 appuser
28
 
29
+ # Switch to the non-root user
 
 
30
  USER appuser
31
 
32
+ # ---- Add this line to fix the PATH issue ----
33
+ ENV PATH="/home/appuser/.local/bin:${PATH}"
34
 
35
+ # Create the cache directory and set ownership to the new user
36
+ # This needs to run as root, so we'll adjust the Dockerfile structure slightly
37
+ USER root
38
+ RUN mkdir -p /app/cache && chown -R appuser:appuser /app /app/cache
39
+ USER appuser
40
+ # ---- END: Non-Root User Configuration ----
41
 
42
+ # Copy requirements file and install dependencies as the non-root user
43
  COPY --chown=appuser:appuser requirements.txt .
44
  RUN pip install --no-cache-dir -r requirements.txt
45
 
46
+ # Clone the NeuTTS Air repository
47
+ RUN git clone https://github.com/neuphonic/neutts-air.git
48
 
49
  # Copy the application code
50
  COPY --chown=appuser:appuser app.py .
 
56
  HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
57
  CMD curl -f http://localhost:7860/health || exit 1
58
 
59
+ # Set the command to run the application
60
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]