Spaces:
Running
Running
| # Use a base image that includes both Python and R. rocker/r-ver is a popular choice for R, with an R base and Python installed. | |
| FROM rocker/r-ver:4.1.0 | |
| # Install Python, pip, and system dependencies for your Python packages, e.g., for matplotlib. | |
| # Dependencies being installed: | |
| # - libfreetype6-dev, libxft-dev for matplotlib | |
| # - libpcre2-dev for -lpcre2-8, liblzma-dev for -llzma, libbz2-dev for -lbz2, libicu-dev for -licuuc and -licui18n for rpy2 compilation requirements | |
| RUN apt-get update && apt-get install -y \ | |
| python3-pip \ | |
| python3-dev \ | |
| libfreetype6-dev \ | |
| libxft-dev \ | |
| libpcre2-dev \ | |
| liblzma-dev \ | |
| libbz2-dev \ | |
| libicu-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install R packages | |
| RUN R -e "install.packages(c('relaimpo', 'readxl', 'readr', 'lavaan', 'leaps', 'dplyr', 'tidyr'), repos='http://cran.rstudio.com/')" | |
| # Copy the requirements.txt file, your app script, and the R script into the container. | |
| COPY requirements.txt /requirements.txt | |
| COPY app.py /app.py | |
| COPY process_data.R /process_data.R | |
| COPY example_files /example_files | |
| COPY images /images | |
| COPY data_source /data_source | |
| # Install Python dependencies from requirements.txt. | |
| RUN pip3 install --no-cache-dir -r /requirements.txt | |
| # Expose the port Gradio runs on. | |
| EXPOSE 7860 | |
| # Command to run your app. | |
| CMD ["python3", "/app.py"] | |