Spaces:
Sleeping
Sleeping
levanel commited on
Commit ·
3cb9d60
1
Parent(s): 402851b
Fix Dockerfile stages and dependencies
Browse files12344 unmodified lines91011121314154 unmodified lines202122232425262728293031324 unmodified lines37383940414243# Stage 1: Build your moduleFROM python:3.10-slim AS builderRUN apt-get update && apt-get install -y --no-install-recommends \4 unmodified lines&& rm -rf /var/lib/apt/lists/*WORKDIR /appRUN pip install --no-cache-dir gradio numpy pypdf transformers torch --extra-index-url https://download.pytorch.org/whl/cpu# Copy only what your engine needsCOPY CMakeLists.txt ./4 unmodified linescmake -DCMAKE_BUILD_TYPE=Release .. && \make vecmini# Stage 2: Final Runtime EnvironmentFROM python:3.10-slimRUN useradd -m -u 1000 userWORKDIR /home/user/app# Install runtime math dependenciesRUN apt-get update && apt-get install -y --no-install-recommends \libopenblas0 \libomp-dev \4 unmodified lines# Copy your frontend code (app.py)COPY --chown=user . /home/user/appRUN pip install --no-cache-dir gradio numpyENV PORT=7860EXPOSE 78601234564 unmodified lines1112131415161718194 unmodified lines2425262728293031323334353637384 unmodified lines434445464748495051# ==========================================# STAGE 1: Build Environment (Temporary)# ==========================================FROM python:3.10-slim AS builderRUN apt-get update && apt-get install -y --no-install-recommends \4 unmodified lines&& rm -rf /var/lib/apt/lists/*WORKDIR /app# The builder ONLY needs pybind11 to compile the C++ code!RUN pip install --no-cache-dir pybind11# Copy only what your engine needsCOPY CMakeLists.txt ./4 unmodified linescmake -DCMAKE_BUILD_TYPE=Release .. && \make vecmini# ==========================================# STAGE 2: Final Runtime Environment (Your App)# ==========================================FROM python:3.10-slimRUN useradd -m -u 1000 userWORKDIR /home/user/app# Install runtime C++ math dependenciesRUN apt-get update && apt-get install -y --no-install-recommends \libopenblas0 \libomp-dev \4 unmodified lines# Copy your frontend code (app.py)COPY --chown=user . /home/user/app# IMPORTANT: This is where ALL the runtime Python packages go!RUN pip install --no-cache-dir gradio numpy pypdf transformers torch --extra-index-url https://download.pytorch.org/whl/cpuENV PORT=7860EXPOSE 7860
Dockerfile+13-5