KaiWu Cursor commited on
Commit
c8a7ed0
·
1 Parent(s): 698d302

build(docker): run app under xvfb with OpenGL libs for VTK rendering

Browse files

Install xvfb and Mesa/X11 libraries and wrap the entrypoint with
xvfb-run so VTK can render verification views on headless HF Spaces.

Co-authored-by: Cursor <cursoragent@cursor.com>

Files changed (1) hide show
  1. Dockerfile +8 -1
Dockerfile CHANGED
@@ -2,6 +2,13 @@ FROM mambaorg/micromamba:1.5.8
2
 
3
  WORKDIR /app
4
 
 
 
 
 
 
 
 
5
  COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml /tmp/environment.yml
6
  RUN micromamba create -y -f /tmp/environment.yml && micromamba clean --all --yes
7
 
@@ -18,4 +25,4 @@ ENV PYTHONUNBUFFERED=1
18
 
19
  EXPOSE 7860
20
 
21
- CMD ["micromamba", "run", "-n", "aigc", "python", "app.py"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # VTK needs an X display and OpenGL to render verification views on headless HF Spaces.
6
+ USER root
7
+ RUN apt-get update \
8
+ && apt-get install -y --no-install-recommends xvfb xauth libgl1 libglu1-mesa libxrender1 libxext6 \
9
+ && rm -rf /var/lib/apt/lists/*
10
+ USER $MAMBA_USER
11
+
12
  COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml /tmp/environment.yml
13
  RUN micromamba create -y -f /tmp/environment.yml && micromamba clean --all --yes
14
 
 
25
 
26
  EXPOSE 7860
27
 
28
+ CMD ["xvfb-run", "-a", "micromamba", "run", "-n", "aigc", "python", "app.py"]