|
2 | 2 | FROM ghcr.io/autowarefoundation/autoware:universe-devel AS builder
|
3 | 3 | SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
4 | 4 | ARG ROS_DISTRO
|
5 |
| -ARG LIB_DIR |
6 | 5 | ENV CCACHE_DIR="/root/.ccache"
|
7 |
| -WORKDIR /autoware |
8 |
| -COPY src/simulator /autoware/src/simulator |
| 6 | + |
9 | 7 | COPY docker/scripts/resolve_rosdep_keys.sh /autoware/resolve_rosdep_keys.sh
|
10 | 8 | RUN chmod +x /autoware/resolve_rosdep_keys.sh
|
| 9 | +COPY src/simulator /autoware/src/simulator |
| 10 | +WORKDIR /autoware |
11 | 11 |
|
12 | 12 | # Install dependencies and build the scenario simulator
|
13 | 13 | # hadolint ignore=SC1091
|
14 |
| -RUN --mount=type=ssh \ |
15 |
| - --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
| 14 | +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
16 | 15 | apt-get update \
|
17 |
| - && source /opt/ros/"$ROS_DISTRO"/setup.bash && source /opt/autoware/setup.bash \ |
| 16 | + && source /opt/autoware/setup.bash \ |
18 | 17 | && rosdep update && rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO \
|
19 |
| - && colcon build --cmake-args \ |
20 |
| - "-Wno-dev" \ |
21 |
| - "--no-warn-unused-cli" \ |
22 |
| - --install-base /opt/autoware \ |
23 |
| - --merge-install \ |
24 |
| - --mixin release compile-commands ccache \ |
| 18 | + && /autoware/cleanup_apt.sh |
| 19 | + |
| 20 | +# hadolint ignore=SC1091 |
| 21 | +RUN --mount=type=cache,target=${CCACHE_DIR} \ |
| 22 | + source /opt/autoware/setup.bash \ |
| 23 | + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware \ |
25 | 24 | && find /opt/autoware/lib -type f -name "*.py" -exec chmod +x {} \; \
|
26 |
| - && find /opt/autoware/share -type f -name "*.py" -exec chmod +x {} \; \ |
27 |
| - && apt-get clean \ |
28 |
| - && rm -rf /var/lib/apt/lists/* "$HOME"/.cache |
| 25 | + && find /opt/autoware/share -type f -name "*.py" -exec chmod +x {} \; |
29 | 26 |
|
30 | 27 | # Extract rosdep dependencies for simulator
|
31 | 28 | # hadolint ignore=SC1091
|
32 |
| -RUN source /opt/ros/"$ROS_DISTRO"/setup.bash && source /opt/autoware/setup.bash \ |
33 |
| - && /autoware/resolve_rosdep_keys.sh /autoware/src/simulator ${ROS_DISTRO} --dependency-types=exec \ |
34 |
| - > /rosdep-simulator-depend-packages.txt \ |
35 |
| - && cat /rosdep-simulator-depend-packages.txt |
| 29 | +RUN source /opt/autoware/setup.bash \ |
| 30 | + && /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} --dependency-types=exec \ |
| 31 | + > /rosdep-simulator-exec-depend-packages.txt \ |
| 32 | + && cat /rosdep-simulator-exec-depend-packages.txt |
36 | 33 |
|
37 | 34 | ### Scenario Simulator
|
38 | 35 | FROM ghcr.io/autowarefoundation/autoware:core AS scenario-simulator
|
39 | 36 | SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
40 | 37 | ARG ROS_DISTRO
|
41 | 38 | ARG LIB_DIR
|
42 |
| -WORKDIR /autoware |
| 39 | + |
43 | 40 | COPY --from=builder /opt/autoware /opt/autoware
|
44 |
| -COPY --from=builder /rosdep-simulator-depend-packages.txt /tmp/rosdep-simulator-depend-packages.txt |
| 41 | +COPY --from=builder /rosdep-simulator-exec-depend-packages.txt /tmp/rosdep-simulator-exec-depend-packages.txt |
45 | 42 |
|
46 | 43 | # hadolint ignore=SC2002
|
47 | 44 | RUN --mount=type=ssh \
|
48 | 45 | --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
49 |
| - apt-get update && apt-get install -y curl unzip \ |
50 |
| - && source /opt/ros/"$ROS_DISTRO"/setup.bash && source /opt/autoware/setup.bash \ |
51 |
| - && rosdep update \ |
| 46 | + apt-get update \ |
52 | 47 | # Remove xmlschema and yamale from rosdep packages since we install via pip
|
53 |
| - && sed -i '/\(xmlschema\|yamale\)/d' /tmp/rosdep-simulator-depend-packages.txt \ |
| 48 | + && sed -i '/\(xmlschema\|yamale\)/d' /tmp/rosdep-simulator-exec-depend-packages.txt \ |
54 | 49 | && pip install --no-cache-dir yamale xmlschema \
|
55 |
| - && cat /tmp/rosdep-simulator-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ |
| 50 | + && cat /tmp/rosdep-simulator-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ |
56 | 51 | && /autoware/cleanup_system.sh $LIB_DIR $ROS_DISTRO
|
57 | 52 |
|
58 | 53 | COPY docker/tools/scenario-simulator/entrypoint.sh /entrypoint.sh
|
|
0 commit comments