-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
127 lines (109 loc) · 4.87 KB
/
Dockerfile
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# libcarla build stage
FROM ubuntu:20.04 AS libcarla-builder
WORKDIR /home
# Following run commands are organized in accordance with carla 0.9.15 build guide.
# Install software requirements.
RUN <<EOF
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
apt-get install -y wget software-properties-common &&
add-apt-repository -y ppa:ubuntu-toolchain-r/test &&
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add
EOF
# Install Ubuntu 20.04 requirements.
# Because the build process avoids building Unreal Engine, we also need to install
# C++ stdlib 10.0
RUN <<EOF
apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main"
apt-get update
apt-get install -y build-essential clang-10 lld-10 g++-7 cmake ninja-build libvulkan1 \
python python-dev python3-dev python3-pip libpng-dev libtiff5-dev \
libjpeg-dev libc++-10-dev libc++abi-10-dev sed curl unzip autoconf \
libtool rsync libxml2-dev git
update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-10/bin/clang++ 180 &&
update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-10/bin/clang 180
EOF
# Clone carla repository.
# Carla assets link has been changed, so edit the link in the Update.sh file accordingly.
# Uncomment the line below to install latest assets.
RUN <<EOF
apt-get install -y aria2
git clone --depth=1 --branch=0.9.15 https://github.com/carla-simulator/carla
cd carla
sed -i 's@http://carla-assets.s3.amazonaws.com/\${CONTENT_ID}.tar.gz@https://carla-assets.s3.us-east-005.backblazeb2.com/\${CONTENT_ID}.tar.gz@' Update.sh
# ./Update.sh
EOF
WORKDIR /home/carla
# Modify build scripts to enable installation without Unreal Engine 4.26.
# First 6 lines modify script variables to point to custom directories on the system instead of those defined
# by Unreal Engine environment.
# Next 2 lines fixes errors present in the build scripts.
RUN <<EOF
sed -i 's@export CC="\$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin/clang"@export CC="/usr/bin/clang-10"@' Util/BuildTools/Setup.sh
sed -i 's@export CXX="\$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin/clang++"@export CXX="/usr/bin/clang++-10"@' Util/BuildTools/Setup.sh
sed -i 's@export PATH="\$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin\:\$PATH"@\n@' Util/BuildTools/Setup.sh
sed -i 's@LLVM_INCLUDE="\$UE4_ROOT/Engine/Source/ThirdParty/Linux/LibCxx/include/c++/v1"@LLVM_INCLUDE="/usr/lib/llvm-10/include/c++/v1"@' Util/BuildTools/Setup.sh
sed -i 's@LLVM_LIBPATH="\$UE4_ROOT/Engine/Source/ThirdParty/Linux/LibCxx/lib/Linux/x86_64-unknown-linux-gnu"@LLVM_LIBPATH="/usr/lib/llvm-10/lib"@' Util/BuildTools/Setup.sh
sed -i 's@UNREAL_HOSTED_CFLAGS="--sysroot=\$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/"@UNREAL_HOSTED_CFLAGS="--sysroot=/"@' Util/BuildTools/Setup.sh
sed -i 's@setup downloadplugins:@setup: downloadplugins@' Util/BuildTools/Linux.mk
sed -i 's@https://boostorg.jfrog.io/artifactory/main/release/\${BOOST_VERSION}/source/\${BOOST_PACKAGE_BASENAME}.tar.gz@https://archives.boost.io/release/\${BOOST_VERSION}/source/\${BOOST_PACKAGE_BASENAME}.tar.gz@' Util/BuildTools/Setup.sh
EOF
# Build libcarla
RUN <<EOF
cd Examples/CppClient
make
EOF
FROM ubuntu:20.04 AS protobuf-builder
WORKDIR /home
RUN <<EOF
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y g++ git cmake
EOF
RUN <<EOF
git clone --depth=1 --branch=v29.3 https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive
EOF
RUN <<EOF
cd protobuf
cmake . -DCMAKE_CXX_STANDARD=17
cmake --build .
# ctest --verbose
EOF
FROM ubuntu:20.04 AS carla-zenoh-bridge
WORKDIR /home
RUN <<EOF
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y curl git zip cmake ninja-build
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs >> rustup-init.sh
chmod 755 ./rustup-init.sh
./rustup-init.sh -yq
EOF
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup update
RUN <<EOF
git clone --depth=1 --branch=1.1.1 https://github.com/eclipse-zenoh/zenoh-c.git
mkdir -p build
EOF
RUN <<EOF
cd build
apt-get install -y g++
cmake ../zenoh-c -GNinja
cmake --build .
cmake --build . --target install
EOF
# install zenohcpp
WORKDIR /home
RUN <<EOF
git clone --depth=1 --branch=1.1.1 https://github.com/eclipse-zenoh/zenoh-cpp.git
mkdir zenoh-cpp/build && cd zenoh-cpp/build
cmake .. -DZENOHCXX_ZENOHC=ON -DZENOHCXX_ZENOHPICO=OFF
cmake --install .
EOF
WORKDIR /home
RUN git clone https://github.com/bounverif/carla-zenoh-bridge.git
COPY --from=libcarla-builder /home/carla/Examples/CppClient/libcarla-install ./carla-zenoh-bridge/libcarla-install
COPY --from=protobuf-builder /home/protobuf ./protobuf
WORKDIR /home/protobuf
RUN cmake .. --install .
WORKDIR /home/carla-zenoh-bridge