-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
221 lines (158 loc) · 4.3 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
ARG TAG_DEBIAN='10-slim'
ARG TAG_FASTRTPS='v2.0.1'
ARG TAG_FASTCDR='v1.0.15'
ARG TAG_FASTRTPSGEN='v1.0.4'
ARG TAG_FOONATHAN='v1.0.0'
ARG NPROC=16
### CORE ###################################################
FROM debian:${TAG_DEBIAN} AS core
# To fix the bug then installing Java-JDK on debian slim images
# create a directory for man-pages.
# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
RUN mkdir -p /usr/share/man/man1 && \
apt-get update && \
apt-get install -y \
libasio-dev libtinyxml2-dev \
python3-pip \
git \
gcc g++ cmake \
ant groovy default-jre-headless && \
pip3 install -U colcon-common-extensions vcstool
### BUILDER ################################################
FROM core AS builder
ARG TAG_FASTRTPS
ARG TAG_FASTCDR
ARG TAG_FASTRTPSGEN
ARG TAG_FOONATHAN
ARG NPROC
### Fast CDR
WORKDIR /opt/build
RUN git clone \
--branch ${TAG_FASTCDR} \
https://github.com/eProsima/Fast-CDR.git && \
mkdir Fast-CDR/build && \
cd Fast-CDR/build && \
cmake .. \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE && \
cmake --build . \
--target install \
-j $NPROC
### Foonathan memory
WORKDIR /opt/build
RUN git clone \
--branch ${TAG_FOONATHAN} \
https://github.com/eProsima/foonathan_memory_vendor.git && \
cd foonathan_memory_vendor && \
mkdir build && \
cd build && \
cmake .. \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE && \
cmake --build . \
--target install \
-j ${NPROC}
### Fast RTPS
WORKDIR /opt/build
RUN git clone \
--branch ${TAG_FASTRTPS} \
https://github.com/eProsima/Fast-RTPS.git && \
mkdir Fast-RTPS/build && \
cd Fast-RTPS/build && \
cmake .. \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE && \
cmake --build . \
--target install \
-j ${NPROC}
### Fast-RTPS-Gen
WORKDIR /opt/build
RUN git clone \
--branch ${TAG_FASTRTPSGEN} \
--recursive \
https://github.com/eProsima/Fast-RTPS-Gen.git && \
cd Fast-RTPS-Gen && \
./gradlew assemble && \
mkdir /usr/local/share/fastrtpsgen/ && \
mv scripts/ /usr/local/share/fastrtpsgen/ && \
mv share/ /usr/local/share/fastrtpsgen/
### DEV ####################################################
FROM core AS dev
### Fast CDR
COPY --from=builder \
/usr/local/share/fastcdr \
/usr/local/share/fastcdr
COPY --from=builder \
/usr/local/include/fastcdr \
/usr/local/include/fastcdr
COPY --from=builder \
/usr/local/lib/libfastcdr.so* \
/usr/local/lib/
COPY --from=builder \
/usr/local/lib/cmake/fastcdr \
/usr/local/lib/cmake/fastcdr
### Foonathan memory
COPY --from=builder \
/usr/local/include/foonathan_memory \
/usr/local/include/foonathan_memory
COPY --from=builder \
/usr/local/lib/foonathan_memory \
/usr/local/lib/foonathan_memory
COPY --from=builder \
/usr/local/lib/libfoonathan_memory-*.a \
/usr/local/lib/
COPY --from=builder \
/usr/local/bin/nodesize_dbg \
/usr/local/bin/
COPY --from=builder \
/usr/local/share/foonathan_memory \
/usr/local/share/foonathan_memory
COPY --from=builder \
/usr/local/share/foonathan_memory_vendor \
/usr/local/share/foonathan_memory_vendor
### FastRTPS & FastDDS
COPY --from=builder \
/usr/local/share/fastrtps \
/usr/local/share/fastrtps
COPY --from=builder \
/usr/local/include/fastrtps \
/usr/local/include/fastrtps
COPY --from=builder \
/usr/local/include/fastdds \
/usr/local/include/fastdds
COPY --from=builder \
/usr/local/lib/libfastrtps.so* \
/usr/local/lib/
### Fast-RTPS-Gen
COPY --from=builder \
/usr/local/share/fastrtpsgen/ \
/usr/local/share/fastrtpsgen/
ENV PATH="/usr/local/share/fastrtpsgen/scripts:${PATH}"
### RUNTIME ################################################
FROM debian:${TAG_DEBIAN} AS runtime
RUN apt-get update && \
apt-get install -y \
libtinyxml2-6 \
libssl1.1
COPY --from=builder \
/usr/local/lib/libfastcdr.so* \
/usr/local/lib/
COPY --from=builder \
/usr/local/lib/libfastrtps.so* \
/usr/local/lib/
### EXAMPLES ###############################################
FROM dev AS example-builder
ARG TAG_FASTRTPS
ARG NPROC
RUN git clone \
--branch ${TAG_FASTRTPS} \
https://github.com/eProsima/Fast-RTPS.git && \
mkdir Fast-RTPS/build && \
cd Fast-RTPS/build && \
cmake .. \
-DCOMPILE_EXAMPLES=ON \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE && \
cmake --build . \
--target install \
-j ${NPROC}
FROM runtime AS example
COPY --from=example-builder \
/usr/local/examples/C++ \
/usr/local/examples/C++