Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.git
.gitignore
venv/
__pycache__/
*.pyc
*.pyo
*.pyd
.DS_Store
logs/
hf_space/
docker/
51 changes: 51 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Use NVIDIA CUDA base image
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV TORCH_CUDA_ARCH_LIST="8.0;8.6;8.9;9.0"

# Install system dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-dev \
git \
libsndfile1 \
ffmpeg \
curl \
&& rm -rf /var/lib/apt/lists/*

# Create symbolic link for python
RUN ln -s /usr/bin/python3 /usr/bin/python

# Set working directory
WORKDIR /app

# Copy requirements file
COPY requirements.txt .

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

# Copy application code
COPY maya1/ maya1/
COPY server.sh .
COPY samples.txt .
COPY README.md .

# Create logs directory
RUN mkdir -p logs

# Expose the API port
EXPOSE 8000

# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1

# Run the application
CMD ["uvicorn", "maya1.api_v2:app", "--host", "0.0.0.0", "--port", "8000"]
51 changes: 51 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Maya1 TTS Docker Deployment

This directory contains the configuration for deploying Maya1 TTS using Docker.

## Prerequisites

- Docker installed
- NVIDIA GPU with drivers installed
- NVIDIA Container Toolkit installed (for GPU support)

## Files

- `Dockerfile`: The Docker image definition.
- `docker-gpu.sh`: Helper script to build and run the container with GPU support.
- `.dockerignore`: Specifies files to exclude from the build context.

## Usage

### Using the helper script

Run the following command from the project root or the `docker` directory:

```bash
./docker/docker-gpu.sh
```

This will:
1. Build the Docker image `maya1-tts`.
2. Run the container with all available GPUs.
3. Expose the API on port 8000.

### Manual Build and Run

**Build:**

```bash
docker build -t maya1-tts -f docker/Dockerfile .
```

**Run:**

```bash
docker run --gpus all --ipc=host -p 8000:8000 maya1-tts
```

## Notes

- The container uses `nvidia/cuda:12.1.1-devel-ubuntu22.04` as the base image.
- It installs Python 3.10 and all dependencies from `requirements.txt`.
- The API is available at `http://localhost:8000`.
- Health check is available at `http://localhost:8000/health`.
31 changes: 31 additions & 0 deletions docker/docker-gpu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m'

echo -e "${BLUE}Building Maya1 TTS Docker Image...${NC}"

# Navigate to project root
cd "$(dirname "$0")/.."

# Build the image
docker build -t maya1-tts -f docker/Dockerfile .

if [ $? -eq 0 ]; then
echo -e "${GREEN}Build successful!${NC}"
echo -e "${BLUE}Starting container with GPU support...${NC}"

# Run the container
docker run --gpus all \
--ipc=host \
-p 8000:8000 \
--name maya1-tts-server \
--rm \
-it \
maya1-tts
else
echo -e "\033[0;31mBuild failed!${NC}"
exit 1
fi