Added container related files for deployment

This commit is contained in:
Nik Afiq 2025-11-23 20:38:50 +09:00
parent ec49570dbe
commit 8b37cf5a29
3 changed files with 69 additions and 21 deletions

35
Dockerfile Normal file
View File

@ -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"]

14
docker-compose.yml Normal file
View File

@ -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

View File

@ -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