| |
| FROM python:3.10-slim |
|
|
| |
| ENV PYTHONDONTWRITEBYTECODE 1 |
| ENV PYTHONUNBUFFERED 1 |
|
|
| |
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| build-essential \ |
| wget \ |
| git \ |
| curl \ |
| ca-certificates \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN pip install --no-cache-dir --upgrade pip |
|
|
| |
| RUN pip install --no-cache-dir \ |
| torch==2.5.1 \ |
| torchvision==0.20.1 \ |
| -f https://download.pytorch.org/whl/torch_stable.html |
|
|
| |
| RUN git clone https://github.com/facebookresearch/sam2.git sam2_repo && \ |
| cd sam2_repo && \ |
| pip install -e . |
|
|
| |
| RUN cd /app/sam2_repo/checkpoints && \ |
| chmod +x download_ckpts.sh && \ |
| ./download_ckpts.sh |
|
|
| RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y |
|
|
| |
| RUN pip install --no-cache-dir \ |
| httpx==0.27.2 \ |
| Flask==3.1.0 \ |
| Flask-Cors==5.0.0 \ |
| openai==1.55.3 \ |
| matplotlib==3.9.2 \ |
| tqdm==4.67.0 \ |
| opencv-python==4.10.0.84 \ |
| albumentations==1.4.21 \ |
| gunicorn |
|
|
| |
| COPY . /app/ |
|
|
| |
| RUN curl https://download.pytorch.org/models/resnet50-0676ba61.pth --output /app/resnet50-0676ba61.pth |
|
|
| |
| RUN mv /app/sam2_repo/checkpoints/*.pt /app/ && ls /app/ |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| CMD ["gunicorn", "-b=0.0.0.0:7860", "app:app", "--timeout=0"] |
|
|