-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (52 loc) · 1.81 KB
/
Dockerfile
File metadata and controls
66 lines (52 loc) · 1.81 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
56
57
58
59
60
61
62
63
64
65
66
# Stage 1: Builder
FROM ubuntu:24.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
build-essential \
g++-14 \
gcc-14 \
cmake \
git \
ninja-build \
pkg-config \
libopencv-dev \
libpng-dev \
zlib1g-dev \
libjpeg-dev \
libgtest-dev \
python3.12 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# meson from pip to ensure a version that supports C++23
RUN pip3 install --no-cache-dir --break-system-packages meson
# GCC 14 is needed for C++23 <print> support
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 \
&& update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-14 100 \
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-14 100
# Build the project
WORKDIR /opt/mot.cpp
COPY . .
RUN meson subprojects update --reset \
&& meson setup build --wipe -Dbuildtype=release \
&& meson compile -C build
# Stage 2: Runtime
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
libopencv-dev \
ffmpeg \
python3.12 \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /tmp/
RUN python3 -m venv /opt/mot.cpp/venv \
&& /opt/mot.cpp/venv/bin/pip install --no-cache-dir -r /tmp/requirements.txt
COPY --from=builder /opt/mot.cpp/build/libmot.so /usr/local/lib/
COPY --from=builder /opt/mot.cpp/build/subprojects/tomlplusplus-3.4.0/src/libtomlplusplus.so.3.4.0 /usr/local/lib/
COPY --from=builder /opt/mot.cpp/build/app/mot /usr/local/bin/mot
COPY --from=builder /opt/mot.cpp/app/config /opt/mot.cpp/app/config
COPY --from=builder /opt/mot.cpp/mot-eval.sh /opt/mot.cpp/mot-eval.sh
RUN ldconfig
WORKDIR /opt/mot.cpp
ENTRYPOINT ["mot"]