# Use an official Python runtime as a parent image FROM python:3.9 # Set the working directory in the container WORKDIR /app # Copy the environment YAML file and application code into the container COPY environment.yml /app/environment.yml COPY . /app # Install conda and create the environment RUN apt-get update && \ apt-get install -y curl && \ curl -sSLo /tmp/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ bash /tmp/miniconda.sh -b -p /opt/conda && \ rm /tmp/miniconda.sh && \ /opt/conda/bin/conda env create -f /app/environment.yml # Make RUN commands use the new environment SHELL ["conda", "run", "-n", "opera", "/bin/bash", "-c"] # Install Node.js (required by Gradio for SSR) RUN apt-get install -y nodejs npm && \ npm install -g n && \ n latest && \ export GRADIO_NODE_PATH=$(which node) # Expose port for Hugging Face Spaces EXPOSE 7860 # Run the application CMD ["conda", "run", "-n", "opera", "streamlit", "run", "app.py", "--server.port=7860"]