File size: 944 Bytes
39ec591
 
 
 
 
 
 
 
c898340
 
 
 
 
 
 
 
 
39ec591
 
 
 
 
 
fec937b
39ec591
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04

# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
    git wget unzip ca-certificates python3 python3-pip python3-venv \
    libgl1 libglib2.0-0 && \
    rm -rf /var/lib/apt/lists/*


RUN useradd user
USER user
ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

WORKDIR $HOME/app

COPY --chown=user ./ $HOME/app

# Copy app files
COPY requirements.txt ./
RUN pip3 install --no-cache-dir -r requirements.txt

# Clone RETFound code (for model definitions)
RUN git clone https://github.com/rmaphoh/RETFound_MAE $HOME/app/RETFound_MAE

# Copy the rest
COPY . .

# Expose FastAPI default port for Spaces
ENV PORT=7860

# HF auth picked automatically from env (Spaces provides HF_TOKEN)
ENV HF_HOME=/root/.cache/huggingface \
    TRANSFORMERS_CACHE=/root/.cache/huggingface/transformers \
    TORCH_HOME=/root/.cache/torch

# Start API
CMD ["bash", "startup.sh"]