FROM python:3.10-slim ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV GRADIO_SERVER_NAME=0.0.0.0 ENV GRADIO_SERVER_PORT=7860 # System deps: R + compilers + common R pkg build deps (+ BLAS/LAPACK for glmnet) RUN apt-get update && apt-get install -y --no-install-recommends \ r-base \ r-base-dev \ build-essential \ gfortran \ curl \ git \ libcurl4-openssl-dev \ libssl-dev \ libxml2-dev \ libopenblas-dev \ liblapack-dev \ && rm -rf /var/lib/apt/lists/* # Install required R packages (include glmnet + pROC + Matrix) RUN R -e "options(repos=c(CRAN='https://cloud.r-project.org')); install.packages(c('jsonlite','Matrix','pROC','glmnet'), Ncpus=max(1, parallel::detectCores()-1))" WORKDIR /app COPY . /app # Python deps (from requirements.txt) RUN pip install --no-cache-dir -r requirements.txt # Notebook execution deps RUN pip install --no-cache-dir notebook ipykernel papermill # Optional: only keep these if you truly need them (you probably don't) # RUN pip install --no-cache-dir textblob faker transformers RUN python -m ipykernel install --user --name python3 --display-name "Python 3" # R deps for notebook execution via papermill (IRkernel) RUN R -e "options(repos=c(CRAN='https://cloud.r-project.org')); install.packages('IRkernel')" RUN R -e "IRkernel::installspec(user = FALSE)" EXPOSE 7860 CMD ["python", "-u", "app.py"]