File size: 1,437 Bytes
c2bc1da
 
 
 
f760fda
 
 
 
 
 
 
 
c2bc1da
f760fda
 
 
c2bc1da
 
 
 
 
 
 
 
f760fda
 
 
 
 
c2bc1da
 
f760fda
 
 
c2bc1da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f760fda
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Use an official Python runtime as a parent image
FROM python:3.9.13

# Install system dependencies
# RUN apt-get update && \
#     apt-get install -y \
#     ffmpeg \
#     libgl1 \
#     && apt-get clean \
#     && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
    ffmpeg \
    git \
    curl \
    wget \
    libgl1 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Set up user
RUN useradd -m -u 1000 user
USER user

# # Set environment variables
# ENV HOME=/home/user \
#     PATH=/home/user/.local/bin:$PATH \
#     NUMBA_CACHE_DIR=/tmp/numba_cache

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    NUMBA_CACHE_DIR=/tmp/numba_cache \
    NVIDIA_VISIBLE_DEVICES=all \
    NVIDIA_DRIVER_CAPABILITIES=compute,utility

# Set working directory
WORKDIR $HOME/app

# Copy project files
COPY --chown=user . $HOME/app

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Install Hugging Face CLI and download model checkpoints
RUN pip install huggingface_hub && \
    huggingface-cli download ByteDance/LatentSync --local-dir checkpoints --exclude "*.git*" "README.md" --include "latentsync_unet.pt" "whisper/tiny.pt"

# Expose port
EXPOSE 7860

# Start the application with Gunicorn
# CMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "300", "app:app"]
CMD ["gunicorn", "-w", "2", "-k", "gevent", "-b", "0.0.0.0:7860", "--timeout", "600", "app:app"]