-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (44 loc) · 1.46 KB
/
Dockerfile
File metadata and controls
63 lines (44 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Multi-stage Dockerfile for Aparsoft TTS
# Optimized for production deployment with both CPU and optional GPU support
FROM python:3.12-slim as base
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
espeak-ng \
ffmpeg \
libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 ttsuser
WORKDIR /app
# Copy dependency files
COPY pyproject.toml /app/
# Install Python dependencies
RUN pip install --upgrade pip && \
pip install hatchling && \
pip install -e ".[mcp,cli]"
# Copy application code
COPY aparsoft_tts/ /app/aparsoft_tts/
# Change ownership
RUN chown -R ttsuser:ttsuser /app
# Switch to non-root user
USER ttsuser
# Create directories for outputs and logs
RUN mkdir -p /app/outputs /app/logs
# Expose port for HTTP transport (if using)
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "from aparsoft_tts.core.engine import TTSEngine; TTSEngine()" || exit 1
# Default command runs MCP server
CMD ["python", "-m", "aparsoft_tts.mcp_server"]
# GPU-enabled variant (optional)
FROM base as gpu
USER root
# Install CUDA dependencies if needed
# RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
USER ttsuser