Spaces:
Sleeping
Sleeping
File size: 1,510 Bytes
93ed5d4 d80f1cb 07ec6e7 d80f1cb 93ed5d4 8a8c9e1 dc0f6fa 8a8c9e1 f20e1e0 93ed5d4 a1b81e3 93ed5d4 a1b81e3 f20e1e0 | 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 | # Conda base with VMTK
FROM continuumio/miniconda3:latest
WORKDIR /app
# VTK requires OpenGL system libraries which aren't in the base miniconda image
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglib2.0-0 libsm6 libxrender1 libxext6 libosmesa6 \
&& rm -rf /var/lib/apt/lists/*
# Create the vmtk conda environment
COPY environment.yml .
RUN conda env create -f environment.yml && conda clean -afy
# Verify the VMTK install: SetInputData must exist on VMTK filter objects
RUN conda run -n vmtk_env python -c "import vtk; print('VTK', vtk.vtkVersion.GetVTKVersion()); from vmtk import vtkvmtkMiscPython as m; f = m.vtkvmtkPolyDataNetworkExtraction(); assert hasattr(f, 'SetInputData'), 'SetInputData missing - ABI mismatch'; print('VMTK SetInputData OK')"
# Install Flask + CORS + gunicorn inside the vmtk_env
RUN conda run -n vmtk_env pip install --no-cache-dir flask flask-cors gunicorn
# Copy the backend source code
COPY centerline_extraction.py ostium_detection.py endograft_generation.py server.py ./
# Hugging Face Spaces expects port 7860, server.py reads PORT from env
ENV PORT=7860
EXPOSE 7860
# Run with gunicorn for production stability, timeout 600 allows up to 10 minutes per request (Voronoi can be slow)
CMD ["conda", "run", "--no-capture-output", "-n", "vmtk_env", \
"gunicorn", "server:app", \
"--bind", "0.0.0.0:7860", \
"--timeout", "600", \
"--workers", "1", \
"--log-level", "info"]
|