-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (45 loc) · 2.2 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (45 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# syntax=docker/dockerfile:1.7
# =============================================================================
# swift — On-Device CoreML Bioacoustic Classifier
# =============================================================================
# CoreML only exists on Apple platforms. This container therefore runs the
# *fallback* ONNX path (currently routed through the deterministic stub
# classifier shipped in `Sources/Runtime/Tools/CoreMLClassify.swift`).
#
# On macOS you should instead use `make run-host-runtime`, which runs the
# Swift runtime natively on the host and uses real CoreML when an
# `.mlpackage` is provisioned. This Dockerfile remains useful for:
# * proving the SDK resolves at build time (`make verify`)
# * running the client TUI in the standard 3-container layout
# * containerised CI runs on Linux
# -----------------------------------------------------------------------------
FROM swift:5.10-jammy AS build
ARG ARCP_SDK_VERSION=latest
WORKDIR /src
COPY Package.swift ./
COPY Sources/ ./Sources/
COPY Samples/ ./Samples/
# `latest` → main branch; otherwise pin. (Currently a no-op while the
# example builds against the vendored ArcpStub. Wired so re-enabling the
# real git dependency is a single uncomment.)
RUN if [ -n "$(grep '/\\* ARCP_VERSION \\*/' Package.swift)" ]; then \
if [ "$ARCP_SDK_VERSION" = "latest" ]; then \
sed -i 's|/\* ARCP_VERSION \*/.*$|.branch("main")|' Package.swift; \
else \
sed -i "s|/\* ARCP_VERSION \*/.*\$|.exact(\"${ARCP_SDK_VERSION}\")|" Package.swift; \
fi \
fi
RUN swift build -c release --static-swift-stdlib
RUN mkdir -p /out && \
cp .build/release/BioacousticRuntime /out/runtime && \
cp .build/release/bioacoustic /out/bioacoustic
# -----------------------------------------------------------------------------
FROM ubuntu:22.04 AS runtime
RUN apt-get update \
&& apt-get install -y --no-install-recommends tini ca-certificates libcurl4 libxml2 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /out/runtime /usr/local/bin/runtime
COPY --from=build /out/bioacoustic /usr/local/bin/bioacoustic
COPY --from=build /src/Samples /samples
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/usr/local/bin/runtime"]