Audio-EvalBot / Dockerfile
norhan12's picture
Initial project setup with multi-URL API
5327928
raw
history blame
1.24 kB
FROM python:3.10-slim
# 1. Install system dependencies
RUN apt-get update && apt-get install -y \
libsndfile1 \
ffmpeg \
sox \
curl \
git-lfs \
&& rm -rf /var/lib/apt/lists/*
# 2. Create non-root user (moved up for better permissions)
RUN useradd -m appuser
# 3. Create directory structure (with proper ownership from the start)
RUN mkdir -p \
/tmp/matplotlib \
/tmp/fontconfig \
/tmp/lhotse \
/app/uploads \
/app/processed_audio \
/app/assets && \
chown -R appuser:appuser /app /tmp/matplotlib /tmp/fontconfig /tmp/lhotse
# 4. Set working directory
WORKDIR /app
# 5. Copy application files
COPY --chown=appuser:appuser . .
# 6. Set environment variables
ENV MPLCONFIGDIR=/tmp/matplotlib \
FONTCONFIG_PATH=/tmp/fontconfig \
LHOTSE_CACHE_DIR=/tmp/lhotse \
HF_HUB_ENABLE_HF_TRANSFER=1 \
PYTHONUNBUFFERED=1
# 7. Install Python dependencies
USER appuser
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
python -m spacy download en_core_web_sm && \
pip check
# 8. Health check
HEALTHCHECK --interval=30s --timeout=10s \
CMD curl -f http://localhost:7860/ || exit 1
# 9. Run the application
CMD ["python", "app.py"]