Files
edge-tts/web/Dockerfile
2025-12-02 12:22:06 +08:00

43 lines
985 B
Docker

# Edge TTS Web UI - Production Dockerfile
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY *.py .
COPY *.html .
COPY *.css .
COPY *.js .
COPY *.json .
COPY *.png . 2>/dev/null || true
COPY *.svg . 2>/dev/null || true
# Create non-root user for security
RUN useradd -m -u 1000 appuser && \
chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')"
# Run the application
CMD ["python", "server.py", "--host", "0.0.0.0", "--port", "8000"]