Skip to content

Commit

Permalink
edit docker
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayballal95 committed Oct 19, 2024
1 parent 6d27b0f commit 12b82c1
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
# Build application

# Download Intel GPG key and add repository
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list

# Install Intel MKL and extract libiomp5.so
RUN apt-get update \
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list \
&& apt-get update \
&& apt-get install -y intel-oneapi-mkl-devel \
&& cp /opt/intel/oneapi/compiler/2024.2/lib/libiomp5.so /app/libiomp5.so
&& export LD_LIBRARY_PATH="/opt/intel/oneapi/compiler/2024.2/lib:$LD_LIBRARY_PATH"

RUN apt-get install libssl-dev pkg-config python3-full python3-pip -y
RUN pip3 install maturin[patchelf] --break-system-packages
Expand All @@ -30,16 +27,17 @@ FROM python:3.11-slim

WORKDIR /app

# Copy the extracted libiomp5.so from the builder stage
COPY --from=builder /app/libiomp5.so /usr/lib/
COPY . .

COPY --from=builder /app/target/wheels .

# Set the library path
ENV LD_LIBRARY_PATH="/usr/lib:$LD_LIBRARY_PATH"
RUN pip install *.whl

COPY . .
RUN pip install numpy pillow pytest onnxruntime pymupdf numpy

RUN pip install target/wheels/*.whl
# Set the library path, initializing it if not already set
ENV LD_LIBRARY_PATH="/usr/lib"

RUN pip install numpy pillow pytest
ENV ORT_DYLIB_PATH="/usr/local/lib/python3.11/site-packages/onnxruntime/capi/libonnxruntime.so.1.19.2"

CMD ["pytest"]
CMD ["pytest tests"]

0 comments on commit 12b82c1

Please sign in to comment.