therapy-companion / Dockerfile
Elliot89's picture
Update Dockerfile
951c1da verified
# Use a stable Python 3.11 base image
FROM python:3.11-slim
# Set environment variables for compatibility
ENV PYTHONUNBUFFERED=1 \
DEBIAN_FRONTEND=noninteractive \
TF_ENABLE_ONEDNN_OPTS=0 \
TF_CPP_MIN_LOG_LEVEL=2
# Set the working directory
WORKDIR /app
# Install system dependencies, including FFmpeg, as root
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy and install Python requirements first to leverage Docker cache
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
# Create necessary directories for the app to function
RUN mkdir -p /app/captured_images /app/temp_audio
# Expose the port required by Hugging Face Spaces
EXPOSE 7860
# --- PRODUCTION SERVER COMMAND ---
# Use Gunicorn to run the app instead of Flask's development server
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "3", "--timeout", "120", "app:app"]
# ---------------------------------