FROM python:3.11-slim # Set the working directory for the container WORKDIR /usr/src/app # Copy and install dependencies COPY app/requirements.txt ./backend-requirements.txt COPY fe/requirements.txt ./frontend-requirements.txt RUN pip install --no-cache-dir -r backend-requirements.txt -r frontend-requirements.txt # Set cache directories to /tmp ENV HF_HOME=/tmp/huggingface ENV TRANSFORMERS_CACHE=/tmp/huggingface # Set PYTHONPATH to ensure all modules are discoverable ENV PYTHONPATH=/usr/src/app # Copy backend files COPY config.py ./config.py COPY app/ ./app/ COPY run.py ./run.py # Copy frontend files COPY fe/ ./frontend/ # Expose ports for backend and frontend EXPOSE 8000 7860 # Run both backend and frontend in parallel CMD ["sh", "-c", "python run.py & python -m frontend.gradio_app"]