background / Dockerfile
mythaitts's picture
Upload 3 files
ddaaa1b verified
Raw
History Blame Contribute Delete
1.2 kB
# Relay backend engine - Docker image (Hugging Face Space / any host)
# Minimal base: python:3.11-slim (HF Spaces standard, Python preinstalled).
# No extra OS distro layers needed.
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
DATA_DIR=/data
WORKDIR /app
# Optional system dep: ffmpeg is only needed for mp3->wav transcoding of OpenAI TTS output.
# Remove this line if you don't use OpenAI TTS.
RUN apt-get update \
&& apt-get install -y --no-install-recommends ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --upgrade pip && pip install -r requirements.txt
# Copy application
COPY main.py .
COPY .env.example .env
# Persistence volume (/data): SQLite DB, recordings, transcripts
VOLUME ["/data"]
RUN mkdir -p /data/recordings
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health', timeout=3)" || exit 1
# For Hugging Face Spaces (port comes from env, default 7860 on Spaces)
CMD ["sh", "-c", "python main.py"]