relaxntakenotes-api / Dockerfile
One2SkipAfew's picture
Upload 3 files
5b839b7 verified
Raw
History Blame Contribute Delete
1.05 kB
# Use official lightweight Python image
FROM python:3.11-slim
# Install system dependencies for edge-tts
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ffmpeg \
portaudio19-dev \
&& rm -rf /var/lib/apt/lists/*
# Set up user with UID 1000 per Hugging Face Spaces requirements
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:${PATH}"
# Set the working directory
WORKDIR /app
# Copy requirements and install dependencies
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy the rest of the application files
COPY --chown=user:user main.py .
# Expose the default port for Hugging Face Spaces
EXPOSE 7860
# Container healthcheck
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1
# Run FastAPI app with Uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "1800"]