1- FROM --platform=$BUILDPLATFORM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu24.04
2- # Set non-interactive frontend
3- ENV DEBIAN_FRONTEND=noninteractive
1+ FROM --platform=$BUILDPLATFORM nvidia/cuda:12.8.1-base-ubuntu24.04
42
53# Install Python and other dependencies
6- RUN apt-get update && apt-get install -y \
7- python3.10 \
8- python3-venv \
9- espeak-ng \
10- espeak-ng-data \
11- git \
12- libsndfile1 \
13- curl \
14- ffmpeg \
15- g++ \
16- && apt-get clean && rm -rf /var/lib/apt/lists/* \
17- && mkdir -p /usr/share/espeak-ng-data \
18- && ln -s /usr/lib/*/espeak-ng-data/* /usr/share/espeak-ng-data/
19-
20- # Install UV using the installer script
21- RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
4+ RUN apt-get update -y && \
5+ apt-get install -y python3.10 python3-venv espeak-ng espeak-ng-data git libsndfile1 curl ffmpeg g++ && \
6+ apt-get clean && rm -rf /var/lib/apt/lists/* && \
7+ mkdir -p /usr/share/espeak-ng-data && \
8+ ln -s /usr/lib/*/espeak-ng-data/* /usr/share/espeak-ng-data/ && \
9+ curl -LsSf https://astral.sh/uv/install.sh | sh && \
2210 mv /root/.local/bin/uv /usr/local/bin/ && \
23- mv /root/.local/bin/uvx /usr/local/bin/
24-
25- # Create non-root user and set up directories and permissions
26- RUN useradd -m -u 1001 appuser && \
11+ mv /root/.local/bin/uvx /usr/local/bin/ && \
12+ useradd -m -u 1001 appuser && \
2713 mkdir -p /app/api/src/models/v1_0 && \
2814 chown -R appuser:appuser /app
2915
@@ -33,14 +19,9 @@ WORKDIR /app
3319# Copy dependency files
3420COPY --chown=appuser:appuser pyproject.toml ./pyproject.toml
3521
36- ENV PHONEMIZER_ESPEAK_PATH=/usr/bin \
37- PHONEMIZER_ESPEAK_DATA=/usr/share/espeak-ng-data \
38- ESPEAK_DATA_PATH=/usr/share/espeak-ng-data
39-
40- # Install dependencies with GPU extras (using cache mounts)
41- RUN --mount=type=cache,target=/root/.cache/uv \
42- uv venv --python 3.10 && \
43- uv sync --extra gpu
22+ # Install dependencies with GPU extras
23+ RUN uv venv --python 3.10 && \
24+ uv sync --extra gpu --no-cache
4425
4526# Copy project files including models
4627COPY --chown=appuser:appuser api ./api
@@ -50,18 +31,21 @@ RUN chmod +x ./entrypoint.sh
5031
5132
5233# Set all environment variables in one go
53- ENV PYTHONUNBUFFERED=1 \
34+ ENV PATH="/app/.venv/bin:$PATH" \
35+ PYTHONUNBUFFERED=1 \
5436 PYTHONPATH=/app:/app/api \
55- PATH="/app/.venv/bin:$PATH" \
5637 UV_LINK_MODE=copy \
57- USE_GPU=true
58-
38+ USE_GPU=true \
39+ PHONEMIZER_ESPEAK_PATH=/usr/bin \
40+ PHONEMIZER_ESPEAK_DATA=/usr/share/espeak-ng-data \
41+ ESPEAK_DATA_PATH=/usr/share/espeak-ng-data \
42+ DEVICE="gpu"
43+
5944ENV DOWNLOAD_MODEL=true
6045# Download model if enabled
6146RUN if [ "$DOWNLOAD_MODEL" = "true" ]; then \
6247 python download_model.py --output api/src/models/v1_0; \
6348 fi
6449
65- ENV DEVICE="gpu"
6650# Run FastAPI server through entrypoint.sh
6751CMD ["./entrypoint.sh" ]
0 commit comments