Skip to content

Commit ffd46dc

Browse files
committed
Add opencv to webots image.
1 parent b0ebaab commit ffd46dc

4 files changed

Lines changed: 62 additions & 17 deletions

File tree

ch32-riscv/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ LABEL description="This is a Docker Image for XRobot build."
88
RUN apt update && apt upgrade -y --no-install-recommends && \
99
apt install -y --no-install-recommends xz-utils git curl sudo wget zip make && apt install -y net-tools usbutils nano gdb cmake ninja-build file clang-18 clangd clang-tidy gcc g++ python3-tk && apt clean
1010

11-
RUN ln -s /usr/bin/clang++-18 /usr/bin/clang++ && ln -s /usr/bin/clang-18 /usr/bin/clang
11+
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 && \
12+
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
1213

1314
RUN sudo mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.bk
1415

esp32/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ RUN apt update
1010
RUN apt upgrade -y --no-install-recommends && \
1111
apt install -y --no-install-recommends xz-utils git curl sudo wget zip make && apt install -y net-tools usbutils nano gdb cmake ninja-build file clang-18 clangd clang-tidy gcc g++ python3-tk python3.12-venv && apt clean
1212

13-
RUN ln -s /usr/bin/clang++-18 /usr/bin/clang++ && ln -s /usr/bin/clang-18 /usr/bin/clang
13+
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 && \
14+
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
1415

1516
RUN sudo mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.bk
1617

linux/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN apt upgrade -y --no-install-recommends & apt install -y --no-install-recomme
1111

1212
RUN sudo mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.bk
1313

14-
RUN ln -s /usr/bin/clang++-18 /usr/bin/clang++ && ln -s /usr/bin/clang-18 /usr/bin/clang
14+
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 && \
15+
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
1516

1617
RUN ln -s /usr/bin/python3 /usr/bin/python && curl -sS https://bootstrap.pypa.io/get-pip.py | python3

webots/Dockerfile

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,59 @@ FROM ubuntu:24.04
22

33
ARG DEBIAN_FRONTEND=noninteractive
44

5-
LABEL maintainer="2592509183@qq.com"
6-
LABEL description="This is a Docker Image for XRobot build."
7-
8-
RUN apt update
9-
10-
RUN apt upgrade -y --no-install-recommends & apt install -y --no-install-recommends xz-utils git curl sudo wget zip make && apt install -y net-tools usbutils nano gdb cmake ninja-build file clang-18 clangd clang-tidy gcc g++ python3-tk && apt clean
11-
12-
RUN ln -s /usr/bin/clang++-18 /usr/bin/clang++ && ln -s /usr/bin/clang-18 /usr/bin/clang
13-
14-
RUN sudo mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.bk
15-
16-
RUN wget https://github.com/cyberbotics/webots/releases/download/R2023a/webots_2023a_amd64.deb -O ./webots.deb && apt install ./webots.deb -y --no-install-recommends && rm webots.deb
17-
18-
RUN ln -s /usr/bin/python3 /usr/bin/python && curl -sS https://bootstrap.pypa.io/get-pip.py | python3
5+
LABEL maintainer="2592509183@qq.com" \
6+
description="Docker Image for XRobot build with Webots and OpenCV 4.10.0"
7+
8+
RUN apt-get update && \
9+
apt-get upgrade -y --no-install-recommends && \
10+
apt-get install -y --no-install-recommends \
11+
xz-utils git curl sudo wget zip unzip make file nano gdb \
12+
net-tools usbutils \
13+
cmake ninja-build \
14+
clang-18 clangd clang-tidy \
15+
gcc g++ \
16+
python3 python3-venv python3-tk \
17+
libwpa-client-dev libnm-dev libudev-dev \
18+
ca-certificates pkg-config && \
19+
rm -rf /var/lib/apt/lists/*
20+
21+
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 && \
22+
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
23+
24+
RUN mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.bk || true && \
25+
ln -sf /usr/bin/python3 /usr/bin/python && \
26+
curl -sS https://bootstrap.pypa.io/get-pip.py | python3
27+
28+
RUN set -eux; \
29+
apt-get update; \
30+
wget -O /tmp/webots.deb https://github.com/cyberbotics/webots/releases/download/R2023a/webots_2023a_amd64.deb; \
31+
apt-get install -y --no-install-recommends /tmp/webots.deb; \
32+
rm -f /tmp/webots.deb; \
33+
rm -rf /var/lib/apt/lists/*
34+
35+
RUN set -eux; \
36+
apt-get update; \
37+
apt-get install -y --no-install-recommends \
38+
libjpeg-dev libpng-dev libtiff-dev \
39+
libavcodec-dev libavformat-dev libswscale-dev \
40+
libv4l-dev libxvidcore-dev libx264-dev \
41+
libgtk-3-dev libcanberra-gtk3-module \
42+
libtbb-dev libdc1394-dev libopenexr-dev \
43+
libeigen3-dev && \
44+
rm -rf /var/lib/apt/lists/* && \
45+
cd /tmp && \
46+
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.10.0.zip && \
47+
unzip -q opencv.zip && \
48+
mkdir -p opencv-4.10.0/build && \
49+
cd opencv-4.10.0/build && \
50+
cmake .. \
51+
-DCMAKE_BUILD_TYPE=Release \
52+
-DCMAKE_C_COMPILER=clang \
53+
-DCMAKE_CXX_COMPILER=clang++ \
54+
-DCMAKE_CXX_STANDARD=14 \
55+
-DBUILD_TESTS=OFF \
56+
-DBUILD_PERF_TESTS=OFF && \
57+
make -j"$(nproc)" && \
58+
make install && \
59+
ldconfig && \
60+
cd / && rm -rf /tmp/opencv.zip /tmp/opencv-4.10.0

0 commit comments

Comments
 (0)