# Use a Python base image. Python 3.9+ is recommended for latest Streamlit/FastAPI. FROM python:3.9-slim-buster # Set the working directory in the container WORKDIR /app # Install system dependencies needed for soundfile and pydub (ffmpeg) # and supervisord RUN apt-get update && apt-get install -y \ ffmpeg \ supervisor \ --no-install-recommends && \ rm -rf /var/lib/apt/lists/* # Copy requirements.txt and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Create a directory for Whisper model cache to prevent re-downloading on container restart # This assumes /root/.cache/whisper is the default location. # Ensure it's writable by the user that runs the app. ENV XDG_CACHE_HOME="/app/.cache" RUN mkdir -p /app/.cache/whisper && chmod -R 777 /app/.cache # Copy the rest of your application code COPY . . # Set environment variables for Twilio (replace with your actual SID and Token or pass at runtime) # IMPORTANT: For production, do NOT hardcode credentials. Use Docker secrets or pass via docker run -e. # Example: # ENV TWILIO_ACCOUNT_SID="ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # ENV TWILIO_AUTH_TOKEN="your_auth_token_here" # Expose ports that your applications will use EXPOSE 1990 EXPOSE 8501 # Create supervisord configuration file # This tells supervisord to run both FastAPI and Streamlit RUN mkdir -p /etc/supervisor/conf.d/ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Command to run supervisord when the container starts CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf", "-n"]