File size: 3,187 Bytes
2588ff8
 
 
 
04df1be
2588ff8
 
 
 
 
 
0f9a8f0
cca7c61
 
 
2588ff8
93d5b3b
0f9a8f0
2588ff8
 
7d24b00
 
 
 
 
2588ff8
 
 
 
7d24b00
2588ff8
 
 
7d24b00
2588ff8
93d5b3b
b97f1d0
 
 
 
93d5b3b
2588ff8
4630437
 
2588ff8
7d24b00
c5a8f36
 
 
 
4656454
 
 
 
 
7d24b00
 
 
2588ff8
7d24b00
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
FROM python:3.10-slim

# ── System deps for MuJoCo EGL rendering ─────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
    libgl1 \
    libglib2.0-0 \
    libegl1 \
    libgles2 \
    libglvnd0 \
    libglx0 \
    libx11-6 \
    libopengl0 \
    libosmesa6 \
    libegl-mesa0 \
    libgl1-mesa-dri \
    wget \
    git \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# ── Create user for Hugging Face Spaces ───────────────────────────────────────
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# ── Create working directory ──────────────────────────────────────────────────
WORKDIR /app

# ── Copy requirements first (layer caching) ──────────────────────────────────
COPY --chown=user ./requirements-server.txt requirements-server.txt
RUN pip install --no-cache-dir -r requirements-server.txt

# ── Copy project ──────────────────────────────────────────────────────────────
COPY --chown=user . /app

# ── Download MuJoCo Menagerie (Panda arm) ─────────────────────────────────────
RUN git clone --depth 1 --filter=blob:none --sparse https://github.com/google-deepmind/mujoco_menagerie.git \
    && cd mujoco_menagerie \
    && git sparse-checkout set franka_emika_panda \
    && rm -rf .git

# ── MuJoCo environment ────────────────────────────────────────────────────────
ENV MUJOCO_GL=egl
ENV PYOPENGL_PLATFORM=egl

# ── Limit Threads ─────────────────────────────────────────────────────────────
ENV OPENBLAS_NUM_THREADS=1
ENV OMP_NUM_THREADS=1
ENV MKL_NUM_THREADS=1

# ── Simulation Quality ────────────────────────────────────────────────────────
ENV SEMSORTER_STREAM_WIDTH=1280
ENV SEMSORTER_STREAM_HEIGHT=720
ENV SEMSORTER_STREAM_JPEG_QUALITY=90

# ── Expose port ───────────────────────────────────────────────────────────────
EXPOSE 7860

# ── Start server ──────────────────────────────────────────────────────────────
CMD ["uvicorn", "SemSorter.server.app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]