Spaces:
Running
Running
# 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 build-essential cmake libopenblas-dev liblapack-dev libopenblas-dev liblapack-dev | |
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 build-essential cmake libopenblas-dev liblapack-dev libopenblas-dev liblapack-dev | |
# Create the "model" directory with appropriate permissions | |
RUN mkdir -p /app/model && chmod -R 777 /app/model | |
COPY --from=builder /app/venv venv | |
COPY app.py . | |
COPY models.py . | |
COPY test_functions.py . | |
COPY examples/ /app/examples/ | |
RUN chmod -R 777 /app/examples/ | |
COPY assets/ assets/ | |
ENV VIRTUAL_ENV=/app/venv | |
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | |
EXPOSE 7000 | |
CMD ["python", "app.py"] | |