# FROM python:3.10-slim # # Set working directory # WORKDIR /app # # Install system packages # RUN apt-get update && apt-get install -y ffmpeg git wget && rm -rf /var/lib/apt/lists/* # # Set environment for proper model caching and permissions # ENV PYTHONUNBUFFERED=1 # ENV HOME=/app # ENV XDG_CACHE_HOME=/app/.cache # ENV SPEECHBRAIN_CACHE=/app/.cache/speechbrain # # Create all needed directories with write permissions # RUN mkdir -p /app/pretrained_models \ # /app/wav2vec2_checkpoints \ # /app/pretrained_asr \ # /app/.cache/whisper \ # /app/.cache/speechbrain \ # /app/tmp \ # && chmod -R 777 /app/pretrained_models \ # /app/wav2vec2_checkpoints \ # /app/pretrained_asr \ # /app/.cache \ # /app/tmp \ # /app # # Upgrade pip # RUN pip install --no-cache-dir --upgrade pip --root-user-action=ignore # # Copy source # COPY . . # # Download Hugging Face interface file # RUN mkdir -p src && wget -O src/custome_interface.py https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/custom_interface.py # # Install Python dependencies # RUN pip install --no-cache-dir -r requirements.txt --root-user-action=ignore # # Expose Streamlit port # EXPOSE 8501 # # Run Streamlit app # CMD ["streamlit", "run", "streamlit_app.py", "--server.port=8501"] FROM python:3.10-slim # Set working directory WORKDIR /app # Install system packages and Ollama dependencies RUN apt-get update && \ apt-get install -y ffmpeg git wget curl gnupg && \ rm -rf /var/lib/apt/lists/* # Install Ollama # Use the official install script for robust installation RUN curl -fsSL https://ollama.com/install.sh | sh # Set environment for proper model caching and permissions ENV PYTHONUNBUFFERED=1 ENV HOME=/app ENV XDG_CACHE_HOME=/app/.cache ENV SPEECHBRAIN_CACHE=/app/.cache/speechbrain # Create all needed directories with write permissions RUN mkdir -p /app/pretrained_models \ /app/wav2vec2_checkpoints \ /app/pretrained_asr \ /app/.cache/whisper \ /app/.cache/speechbrain \ /app/tmp \ && chmod -R 777 /app # Upgrade pip RUN pip install --no-cache-dir --upgrade pip --root-user-action=ignore # Copy source COPY . . # Copy the startup script and make it executable COPY start.sh /usr/local/bin/start.sh RUN chmod +x /usr/local/bin/start.sh # Download Hugging Face interface file RUN mkdir -p src && wget -O src/custome_interface.py https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/custom_interface.py # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt --root-user-action=ignore # Expose both Streamlit and Ollama ports (for internal communication within Docker, if needed) # Hugging Face Spaces will likely only expose the main Streamlit port EXPOSE 8501 11434 # Use the startup script as the CMD CMD ["/usr/local/bin/start.sh"]