1 Star 0 Fork 0

chonglin/edge-runtime

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Dockerfile 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
# syntax=docker/dockerfile:1.4
FROM rust:1.79.0-bookworm as builder
ARG TARGETPLATFORM
ARG ONNXRUNTIME_VERSION
ARG GIT_V_TAG
ARG PROFILE=release
ARG FEATURES
RUN apt-get update && apt-get install -y llvm-dev libclang-dev clang cmake binutils
WORKDIR /usr/src/edge-runtime
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=${TARGETPLATFORM} --mount=type=cache,target=/usr/src/edge-runtime/target,id=${TARGETPLATFORM} \
GIT_V_TAG=${GIT_V_TAG} cargo build --profile ${PROFILE} --features "${FEATURES}" && \
mv /usr/src/edge-runtime/target/${PROFILE}/edge-runtime /root
RUN objcopy --compress-debug-sections \
--only-keep-debug \
/root/edge-runtime \
/root/edge-runtime.debug
RUN objcopy --strip-debug \
--add-gnu-debuglink=/root/edge-runtime.debug \
/root/edge-runtime
# Application runtime without ONNX
FROM debian:bookworm-slim as edge-runtime-base
RUN apt-get update && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/*
RUN apt-get remove -y perl && apt-get autoremove -y
COPY --from=builder /root/edge-runtime /usr/local/bin/edge-runtime
COPY --from=builder /root/edge-runtime.debug /usr/local/bin/edge-runtime.debug
# ONNX Runtime provider
# Application runtime with ONNX
FROM builder as ort
RUN ./scripts/install_onnx.sh $ONNXRUNTIME_VERSION $TARGETPLATFORM /root/onnxruntime
# ONNX Runtime CUDA provider
# Application runtime with ONNX CUDA
FROM builder as ort-cuda
RUN ./scripts/install_onnx.sh $ONNXRUNTIME_VERSION $TARGETPLATFORM /root/onnxruntime --gpu
FROM builder as preload-models
RUN ./scripts/download_models.sh
# With CUDA
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 as edge-runtime-cuda
COPY --from=edge-runtime-base /usr/local/bin/edge-runtime /usr/local/bin/edge-runtime
COPY --from=builder /root/edge-runtime.debug /usr/local/bin/edge-runtime.debug
COPY --from=ort-cuda /root/onnxruntime/lib/libonnxruntime.so* /usr/lib
COPY --from=preload-models /usr/src/edge-runtime/models /etc/sb_ai/models
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
ENTRYPOINT ["edge-runtime"]
# Base
FROM edge-runtime-base as edge-runtime
COPY --from=ort /root/onnxruntime/lib/libonnxruntime.so* /usr/lib
COPY --from=preload-models /usr/src/edge-runtime/models /etc/sb_ai/models
ENTRYPOINT ["edge-runtime"]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/godlinc/edge-runtime.git
git@gitee.com:godlinc/edge-runtime.git
godlinc
edge-runtime
edge-runtime
main

搜索帮助