@@ -26,20 +26,53 @@ RUN objcopy --strip-debug \
2626 --add-gnu-debuglink=/root/edge-runtime.debug \
2727 /root/edge-runtime
2828
29- RUN ./scripts/install_onnx.sh $ONNXRUNTIME_VERSION $TARGETPLATFORM /root/onnxruntime
30- RUN ./scripts/download_models.sh
3129
32- FROM debian:bookworm-slim
30+ # Application runtime without ONNX
31+ FROM debian:bookworm-slim as edge-runtime-base
3332
3433RUN apt-get update && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/*
3534RUN apt-get remove -y perl && apt-get autoremove -y
3635
3736COPY --from=builder /root/edge-runtime /usr/local/bin/edge-runtime
3837COPY --from=builder /root/edge-runtime.debug /usr/local/bin/edge-runtime.debug
39- COPY --from=builder /root/onnxruntime /usr/local/bin/onnxruntime
40- COPY --from=builder /usr/src/edge-runtime/models /etc/sb_ai/models
4138
4239ENV ORT_DYLIB_PATH=/usr/local/bin/onnxruntime/lib/libonnxruntime.so
43- ENV SB_AI_MODELS_DIR=/etc/sb_ai/models
40+
41+
42+ # ONNX Runtime provider
43+ # Application runtime with ONNX
44+ FROM builder as ort
45+ RUN ./scripts/install_onnx.sh $ONNXRUNTIME_VERSION $TARGETPLATFORM /root/onnxruntime
46+
47+
48+ # ONNX Runtime CUDA provider
49+ # Application runtime with ONNX CUDA
50+ FROM builder as ort-cuda
51+ RUN ./scripts/install_onnx.sh $ONNXRUNTIME_VERSION $TARGETPLATFORM /root/onnxruntime --gpu
52+
53+
54+ FROM builder as preload-models
55+ RUN ./scripts/download_models.sh
56+
57+
58+ # With CUDA
59+ FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 as edge-runtime-cuda
60+
61+ COPY --from=edge-runtime-base /usr/local/bin/edge-runtime /usr/local/bin/edge-runtime
62+ COPY --from=builder /root/edge-runtime.debug /usr/local/bin/edge-runtime.debug
63+ COPY --from=ort-cuda /root/onnxruntime /usr/local/bin/onnxruntime
64+ COPY --from=preload-models /usr/src/edge-runtime/models /etc/sb_ai/models
65+
66+ ENV ORT_DYLIB_PATH=/usr/local/bin/onnxruntime/lib/libonnxruntime.so
67+ ENV NVIDIA_VISIBLE_DEVICES=all
68+ ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
69+
70+ ENTRYPOINT ["edge-runtime" ]
71+
72+
73+ # Base
74+ FROM edge-runtime-base as edge-runtime
75+ COPY --from=ort /root/onnxruntime /usr/local/bin/onnxruntime
76+ COPY --from=preload-models /usr/src/edge-runtime/models /etc/sb_ai/models
4477
4578ENTRYPOINT ["edge-runtime" ]
0 commit comments