# Use Miniconda as the base image FROM continuumio/miniconda3 # Install LHAPDF, FastAPI, Plotly, Numpy and dependencies RUN conda install -c conda-forge lhapdf python=3.10 fastapi uvicorn numpy -y RUN pip install huggingface_hub pydantic plotly # Create a non-root user for security (required by Hugging Face) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app COPY --chown=user . $HOME/app # Environment variable for LHAPDF's local grid cache ENV LHAPDF_DATA_PATH=$HOME/app/lhapdf_data # Expose the port so the container doesn't "crash" on Spaces EXPOSE 7860 # Start the FastAPI server (app.py defines `app`, services/ holds the logic) CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]