# Start from a base image with Python 3.8 FROM python:3.9 # Install R base RUN apt-get update && apt-get install -y r-base && rm -rf /var/lib/apt/lists/* # # Set environment variables to make sure R and Python play nicely together # ENV R_HOME=/usr/lib/R # ENV RPY2_CFFI_MODE=ABI # Copy your requirements.txt file into the container COPY requirements.txt /tmp/ # Install Python dependencies from requirements.txt # Note: Remove rpy2 from requirements.txt and install it here if necessary RUN pip install -r /tmp/requirements.txt RUN pip install rpy2==3.5.11 ENV MPLCONFIGDIR /tmp/matplotlib_cache ENV FONTCONFIGDIR /tmp/ ENV HOME=/homep RUN addgroup --system appgroup && adduser --system --ingroup appgroup appuser # Set permissions for fontconfig cache directory RUN mkdir -p /opt/X11/var/cache/fontconfig && \ chmod -R 755 /opt/X11/var/cache/fontconfig && \ chown -R appuser:appgroup /opt/X11/var/cache/fontconfig # Install R packages from CRAN and Bioconductor RUN R -e "install.packages(c('reshape2', 'remotes'), repos='http://cran.rstudio.com/')" RUN R -e "install.packages('BiocManager', repos='http://cran.rstudio.com/')" RUN R -e "BiocManager::install(c('BSgenome', 'BSgenome.Hsapiens.UCSC.hg19', 'GenomeInfoDb'), ask=FALSE, update=FALSE)" # Install deconstructSigs from GitHub (Bioconductor version removed) RUN R -e "remotes::install_github('raerose01/deconstructSigs', dependencies=TRUE)" # Copy the rest of your application COPY . /app RUN chmod -R 777 /app/others_prediction_explanation/ # Set the working directory WORKDIR /app EXPOSE 7860 # The command to run your application # Adjust this command based on how you run your app (e.g., Flask, Gradio app) CMD ["python", "app.py"]