File size: 1,161 Bytes
a31e333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
768b3c8
 
 
a31e333
 
 
768b3c8
a31e333
 
768b3c8
a31e333
 
768b3c8
 
 
 
 
 
a31e333
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
# NeuralOS Hypervisor v3 -- Text2OS image OS
#
# CPU-first image (the Space is described as "running entirely on CPU").
# For a GPU Space, use Dockerfile.cuda instead.
FROM python:3.11-slim

ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    # oneDNN / OpenMP threading: use the whole box, avoid oversubscription
    OMP_NUM_THREADS=0 \
    # keep the deterministic engine fallback on by default
    NEURALOS_ENGINE=auto \
    NEURALOS_CACHE=/tmp/neural_cache

RUN apt-get update && apt-get install -y --no-install-recommends \
        libgomp1 libglib2.0-0 libsm6 libxrender1 libxext6 curl \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# torch CPU wheels: dramatically smaller and faster to boot than CUDA wheels
RUN pip install --upgrade pip && \
    pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu

COPY requirements.txt .
RUN pip install -r requirements.txt

# real files, not a heredoc -> cacheable layers, diffable source
COPY app.py index.html ./

RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH

EXPOSE 7860
CMD ["python", "app.py"]