| FROM python:3.10-slim | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| libnetcdf-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Note(Lood): Mount with -v "$PWD:/home/user/app" to overwrite the COPY below | |
| RUN pip install --no-cache-dir --upgrade pip | |
| # Enable quick rebuilds by only copying requirements in this layer | |
| COPY --chown=user requirements.txt $HOME/app | |
| RUN pip install -r requirements.txt | |
| COPY --chown=user . $HOME/app | |
| EXPOSE 7860 | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" | |
| CMD ["python", "app.py"] | |
| # Running with gradio enables hot reloading (https://www.gradio.app/guides/developing-faster-with-reload-mode) | |
| # CMD ["gradio", "app.py"] | |
| # Or just run the container without the entrypoint and rerun the python app.py command when you want to reload | |