yukee1992 commited on
Commit
70d76ff
·
verified ·
1 Parent(s): 13c7184

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -8
Dockerfile CHANGED
@@ -1,27 +1,28 @@
1
  FROM python:3.10-slim
2
 
3
- # Set working directory
4
  WORKDIR /app
5
 
6
- # Set environment variables
7
  ENV PYTHONDONTWRITEBYTECODE=1
8
  ENV PYTHONUNBUFFERED=1
9
  ENV HF_HOME=/tmp/huggingface
10
  ENV TORCH_HOME=/tmp/torch
11
  ENV COQUI_TOS_AGREED=1
 
12
 
13
- # Create cache directories with proper permissions
14
  RUN mkdir -p /tmp/tts_models /tmp/huggingface /tmp/torch /tmp/voices /tmp/output && \
15
  chmod 777 /tmp/tts_models /tmp/huggingface /tmp/torch /tmp/voices /tmp/output
16
 
17
- # Install system dependencies
18
  RUN apt-get update && apt-get install -y \
19
  curl \
20
  ffmpeg \
21
  libsndfile1 \
22
- && rm -rf /var/lib/apt/lists/*
 
23
 
24
- # Copy requirements first for better caching
25
  COPY requirements.txt .
26
 
27
  # Install Python dependencies
@@ -34,12 +35,10 @@ COPY app.py .
34
  RUN useradd -m -u 1000 user
35
  USER user
36
 
37
- # Expose port
38
  EXPOSE 7860
39
 
40
  # Health check
41
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
42
  CMD curl -f http://localhost:7860/api/health || exit 1
43
 
44
- # Run the application
45
  CMD ["python", "app.py"]
 
1
  FROM python:3.10-slim
2
 
 
3
  WORKDIR /app
4
 
5
+ # Set environment variables for cache control
6
  ENV PYTHONDONTWRITEBYTECODE=1
7
  ENV PYTHONUNBUFFERED=1
8
  ENV HF_HOME=/tmp/huggingface
9
  ENV TORCH_HOME=/tmp/torch
10
  ENV COQUI_TOS_AGREED=1
11
+ ENV TTS_HOME=/tmp/tts_models
12
 
13
+ # Create cache directories
14
  RUN mkdir -p /tmp/tts_models /tmp/huggingface /tmp/torch /tmp/voices /tmp/output && \
15
  chmod 777 /tmp/tts_models /tmp/huggingface /tmp/torch /tmp/voices /tmp/output
16
 
17
+ # Install only essential packages
18
  RUN apt-get update && apt-get install -y \
19
  curl \
20
  ffmpeg \
21
  libsndfile1 \
22
+ && rm -rf /var/lib/apt/lists/* \
23
+ && apt-get clean
24
 
25
+ # Copy requirements
26
  COPY requirements.txt .
27
 
28
  # Install Python dependencies
 
35
  RUN useradd -m -u 1000 user
36
  USER user
37
 
 
38
  EXPOSE 7860
39
 
40
  # Health check
41
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
42
  CMD curl -f http://localhost:7860/api/health || exit 1
43
 
 
44
  CMD ["python", "app.py"]