37 lines
810 B
Docker
37 lines
810 B
Docker
FROM python:3.11-slim
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
ffmpeg \
|
|
libopus0 \
|
|
libopus-dev \
|
|
pkg-config \
|
|
gcc \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy requirements first for better Docker layer caching
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy source code
|
|
COPY src/ ./src/
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /app/audio/raw /app/audio/processed /app/logs
|
|
|
|
# Run as non-root user
|
|
RUN useradd -m -u 1001 processor
|
|
RUN chown -R processor:processor /app
|
|
USER processor
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD python src/healthcheck.py || exit 1
|
|
|
|
# Start the service
|
|
CMD ["python", "src/processor.py"]
|