LAVCO / Dockerfile
AAdonis's picture
Update Dockerfile
0487660 verified
FROM python:3.9-slim
# Install system dependencies including build tools for compiling packages
RUN apt-get update && apt-get install -y \
git \
build-essential \
gcc \
g++ \
make \
&& rm -rf /var/lib/apt/lists/*
# Install torch 2.4.1 first (required for xcodec2)
# Try installing from PyPI directly (may work with Python 3.9 despite version warning)
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 || \
(echo "torch 2.4.1 failed, trying 2.3.1..." && \
pip install --no-cache-dir torch==2.3.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121)
# Copy requirements and install
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy app
COPY app.py /app/app.py
# Copy examples directory (create examples/ folder in your Space with default audio files)
# If examples/ doesn't exist, this will fail - create the folder and add your WAV files
COPY examples/ /app/examples/
# Set working directory
WORKDIR /app
# Set environment variables for optimal performance
ENV OMP_NUM_THREADS=1
ENV MKL_NUM_THREADS=1
ENV NUMEXPR_NUM_THREADS=1
# Run app
CMD ["python", "app.py"]