| 12345678910111213141516171819202122232425262728293031323334353637 |
- # Tolan Backend Dockerfile
- FROM python:3.11-slim
- # Set working directory
- WORKDIR /app
- # Install system dependencies
- RUN apt-get update && apt-get install -y \
- ffmpeg \
- libsndfile1 \
- && 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 source code
- COPY src/ src/
- COPY run.py .
- COPY .env.example .env
- # Create non-root user
- RUN useradd --create-home --shell /bin/bash tolan
- RUN chown -R tolan:tolan /app
- USER tolan
- # Expose port
- EXPOSE 8765
- # Health check
- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
- CMD python -c "import socket; socket.create_connection(('localhost', 8765), timeout=5)"
- # Run the application
- CMD ["python", "run.py"]
|