File size: 997 Bytes
a923a8f
 
c162ac2
da4b4c2
 
 
 
 
 
a923a8f
9edf2b5
a923a8f
da4b4c2
 
9edf2b5
da4b4c2
 
9edf2b5
da4b4c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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"]