|
1 | 1 | # syntax=docker/dockerfile:1.4
|
| 2 | + |
2 | 3 | FROM rust:1.79.0-bookworm as builder
|
| 4 | + |
3 | 5 | ARG TARGETPLATFORM
|
4 | 6 | ARG GIT_V_VERSION
|
5 | 7 | ARG ONNXRUNTIME_VERSION=1.17.0
|
6 | 8 | ARG PROFILE=release
|
7 | 9 | ARG FEATURES
|
8 | 10 |
|
9 |
| -RUN apt-get update && apt-get install -y llvm-dev libclang-dev clang cmake |
| 11 | +RUN apt-get update && apt-get install -y llvm-dev libclang-dev clang cmake binutils |
| 12 | + |
10 | 13 | WORKDIR /usr/src/edge-runtime
|
11 | 14 |
|
12 |
| -RUN --mount=type=cache,target=/usr/local/cargo/registry,id=${TARGETPLATFORM} \ |
13 |
| - cargo install cargo-strip |
14 | 15 | COPY . .
|
15 | 16 |
|
16 | 17 | RUN --mount=type=cache,target=/usr/local/cargo/registry,id=${TARGETPLATFORM} --mount=type=cache,target=/usr/src/edge-runtime/target,id=${TARGETPLATFORM} \
|
17 | 18 | GIT_V_TAG=${GIT_V_VERSION} cargo build --profile ${PROFILE} --features "${FEATURES}" && \
|
18 |
| - cargo strip && \ |
19 | 19 | mv /usr/src/edge-runtime/target/${PROFILE}/edge-runtime /root
|
20 | 20 |
|
| 21 | +RUN objcopy --compress-debug-sections \ |
| 22 | + --only-keep-debug \ |
| 23 | + /root/edge-runtime \ |
| 24 | + /root/edge-runtime.debug |
| 25 | +RUN objcopy --strip-debug \ |
| 26 | + --add-gnu-debuglink=/root/edge-runtime.debug \ |
| 27 | + /root/edge-runtime |
| 28 | + |
21 | 29 | RUN ./scripts/install_onnx.sh $ONNXRUNTIME_VERSION $TARGETPLATFORM /root/libonnxruntime.so
|
22 | 30 | RUN ./scripts/download_models.sh
|
23 | 31 |
|
24 |
| - |
25 | 32 | FROM debian:bookworm-slim
|
| 33 | + |
26 | 34 | RUN apt-get update && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/*
|
27 | 35 | RUN apt-get remove -y perl && apt-get autoremove -y
|
| 36 | + |
28 | 37 | COPY --from=builder /root/edge-runtime /usr/local/bin/edge-runtime
|
| 38 | +COPY --from=builder /root/edge-runtime.debug /usr/local/bin/edge-runtime.debug |
29 | 39 | COPY --from=builder /root/libonnxruntime.so /usr/local/bin/libonnxruntime.so
|
30 | 40 | COPY --from=builder /usr/src/edge-runtime/models /etc/sb_ai/models
|
| 41 | + |
31 | 42 | ENV ORT_DYLIB_PATH=/usr/local/bin/libonnxruntime.so
|
32 | 43 | ENV SB_AI_MODELS_DIR=/etc/sb_ai/models
|
| 44 | + |
33 | 45 | ENTRYPOINT ["edge-runtime"]
|
0 commit comments