From 8b37cf5a2997e8226ff7391b828d9ec8560051ca Mon Sep 17 00:00:00 2001 From: Nik Afiq Date: Sun, 23 Nov 2025 20:38:50 +0900 Subject: [PATCH] Added container related files for deployment --- Dockerfile | 35 +++++++++++++++++++++++++++++++++++ docker-compose.yml | 14 ++++++++++++++ requirements.txt | 41 ++++++++++++++++++++--------------------- 3 files changed, 69 insertions(+), 21 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..59d0593 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM python:3.12-slim + +# System deps for your libraries + building C extensions +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + ffmpeg \ + libsndfile1 \ + mecab \ + libmecab2 \ + mecab-ipadic-utf8 \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# 1) Install Python deps from requirements +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# 2) Install Cython so we can compile the extension +RUN pip install --no-cache-dir "Cython>=3.0.0" + +# 3) Copy the rest of the project +COPY . . + +# 4) Build the local monotonic_align extension *in place* +# This will create a linux/arm64 + CPython 3.12 .so under monotonic_align/monotonic_align/ +RUN cd monotonic_align && python setup.py build_ext --inplace + +# Optional: reduce CPU thread explosion from numpy/torch +ENV OMP_NUM_THREADS=4 + +EXPOSE 18343 +ENV PORT=18343 + +CMD ["python", "app.py"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7924d7a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +services: + tts: + build: + context: . + dockerfile: Dockerfile + # platform: linux/arm64 # usually not needed on Mac mini, Docker picks it + container_name: tts-service + ports: + - "18343:18343" + environment: + - PORT=18343 + - FLASK_ENV=production + - OMP_NUM_THREADS=4 + restart: unless-stopped \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 33a8b76..43c469b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,26 +1,25 @@ blinker==1.9.0 -cffi==1.17.1 -click==8.1.7 -Cython==3.0.11 -filelock==3.16.1 -Flask==3.1.0 -fsspec==2024.10.0 -imageio-ffmpeg==0.5.1 +cffi==2.0.0 +click==8.3.1 +filelock==3.20.0 +Flask==3.1.2 +fsspec==2025.10.0 +imageio-ffmpeg==0.6.0 itsdangerous==2.2.0 -Jinja2==3.1.4 -MarkupSafe==3.0.2 +Jinja2==3.1.6 +MarkupSafe==3.0.3 mpmath==1.3.0 -networkx==3.4.2 -numpy==2.1.3 -pycparser==2.22 +networkx==3.5 +numpy==2.3.5 +pycparser==2.23 pydub==0.25.1 -pyopenjtalk==0.3.4 -scipy==1.14.1 -setuptools==75.5.0 -soundfile==0.12.1 -sympy==1.13.1 -torch==2.5.1 -tqdm==4.67.0 -typing_extensions==4.12.2 -Unidecode==1.3.8 +pyopenjtalk==0.4.1 +scipy==1.16.3 +setuptools==80.9.0 +soundfile==0.13.1 +sympy==1.14.0 +torch==2.9.1 +tqdm==4.67.1 +typing_extensions==4.15.0 +Unidecode==1.4.0 Werkzeug==3.1.3