File size: 1,607 Bytes
ed374b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2f5d8bd
 
ed374b0
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 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"]