| |
| FROM python:3.10-slim |
|
|
| |
| RUN useradd -m -u 1000 user |
|
|
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| libgl1 \ |
| libglib2.0-0 \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY requirements.txt requirements-docker.txt ./ |
|
|
| |
| |
| |
| |
| RUN pip install --no-cache-dir "numpy>=1.20.0,<2.0" && \ |
| pip install --no-cache-dir torch==2.2.0 torchvision==0.17.0 --index-url https://download.pytorch.org/whl/cpu && \ |
| pip install --no-cache-dir -r requirements-docker.txt |
|
|
| |
| COPY --chown=user:user app.py predictor.py download_ckp.py ./ |
| COPY --chown=user:user .streamlit/ .streamlit/ |
| COPY --chown=user:user static/ static/ |
| COPY --chown=user:user models/ models/ |
| COPY --chown=user:user ui/ ui/ |
| COPY --chown=user:user utils/ utils/ |
| COPY --chown=user:user config/ config/ |
| COPY --chown=user:user samples/ samples/ |
| RUN mkdir -p ckp && chown user:user ckp |
|
|
| |
| |
| |
| ARG HF_MODEL_REPO=Angione-Lab/Shape2Force |
| ENV HF_MODEL_REPO=${HF_MODEL_REPO} |
| RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \ |
| HF_TOKEN=$(cat /run/secrets/HF_TOKEN) python download_ckp.py |
|
|
| |
| RUN chown -R user:user ckp |
|
|
| USER user |
|
|
| EXPOSE 8501 |
| CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"] |
|
|