Spaces:
Running
Running
| # syntax=docker/dockerfile:1.4 | |
| FROM python:3.10-slim | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git r-base r-base-dev libcurl4-openssl-dev libssl-dev libxml2-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Installs tidymodels (which includes workflows, parsnip etc) and randomForest engine | |
| RUN Rscript -e "install.packages(c('tidymodels', 'randomForest'), repos='https://cloud.r-project.org/', dependencies=TRUE)" \ | |
| || (echo "R PACKAGE INSTALLATION FAILED" && exit 1) | |
| RUN pip install --upgrade pip | |
| RUN mkdir -p /app && chmod -R 777 /app | |
| RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \ | |
| git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@github.com/leoncool23/pdpredict.git . \ | |
| || (echo "GIT CLONE FAILED!" && exit 1) | |
| COPY static /app/static | |
| RUN pip install --no-cache-dir -r requirements.txt \ | |
| || (echo "PIP INSTALL FAILED!" && exit 1) | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |