Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 1,724 Bytes
971dddb bb67b0f 971dddb db2a0cd 971dddb bb67b0f 971dddb 634d3ae 971dddb 542acd6 971dddb db2a0cd 971dddb bb67b0f 634d3ae 971dddb 634d3ae db2a0cd 971dddb | 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 62 63 64 65 66 67 68 69 70 71 | # Stage 1: Builder
FROM python:3.12 AS builder
WORKDIR /app
RUN pip install --upgrade pip setuptools wheel
RUN pip install cmake
# Install system build dependencies
RUN apt-get clean && apt-get -y update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
libopenblas-dev \
liblapack-dev \
libx11-dev \
libpng-dev \
libjpeg-dev \
libtiff-dev && \
rm -rf /var/lib/apt/lists/*
ENV CMAKE_BUILD_PARALLEL_LEVEL=4
RUN python -m venv venv
ENV VIRTUAL_ENV=/app/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Stage 2: Runner
FROM python:3.12-slim AS runner
WORKDIR /app
# Install runtime dependency: libopenblas.so.0 is provided by libopenblas-base.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libopenblas0 \
liblapack3 \
libx11-6 \
libpng16-16 \
libjpeg62-turbo \
libtiff6 && \
rm -rf /var/lib/apt/lists/*
ENV HF_HOME=/tmp/huggingface
ENV HUGGINGFACE_HUB_CACHE=/tmp/huggingface
ENV XDG_CACHE_HOME=/tmp/.cache
ENV GRADIO_CACHE_DIR=/tmp/.gradio
ENV GRADIO_EXAMPLES_CACHE=/tmp/.gradio/cached_examples
ENV PYTHONUNBUFFERED=1
RUN mkdir -p /tmp/model /tmp/huggingface /tmp/.cache /tmp/.gradio /tmp/.gradio/cached_examples \
&& chmod -R 777 /tmp/model /tmp/huggingface /tmp/.cache /tmp/.gradio /tmp/.gradio/cached_examples
COPY --from=builder /app/venv venv
COPY app.py models.py test_functions.py test_compress.py ./
COPY examples/ /app/examples/
COPY assets/ /app/assets/
ENV VIRTUAL_ENV=/app/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
EXPOSE 7000
CMD ["python", "app.py"]
|