Skip to content

Commit

Permalink
feat(docker): add universe-localization-mapping runtime image (#5189)
Browse files Browse the repository at this point in the history
  • Loading branch information
youtalk authored Sep 9, 2024
1 parent 247b298 commit 2904e9f
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,28 @@ runs:
latest=false
suffix=-universe-sensing-perception${{ inputs.tag-suffix }}
- name: Docker meta for autoware:universe-localization-mapping-devel
id: meta-universe-localization-mapping-devel
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
bake-target: docker-metadata-action-universe-localization-mapping-devel
flavor: |
latest=false
suffix=-universe-localization-mapping-devel${{ inputs.tag-suffix }}
- name: Docker meta for autoware:universe-localization-mapping
id: meta-universe-localization-mapping
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
bake-target: docker-metadata-action-universe-localization-mapping
flavor: |
latest=false
suffix=-universe-localization-mapping${{ inputs.tag-suffix }}
- name: Docker meta for autoware:universe-devel
id: meta-universe-devel
uses: docker/metadata-action@v5
Expand Down Expand Up @@ -172,6 +194,8 @@ runs:
${{ steps.meta-core-devel.outputs.bake-file }}
${{ steps.meta-universe-sensing-perception-devel.outputs.bake-file }}
${{ steps.meta-universe-sensing-perception.outputs.bake-file }}
${{ steps.meta-universe-localization-mapping-devel.outputs.bake-file }}
${{ steps.meta-universe-localization-mapping.outputs.bake-file }}
${{ steps.meta-universe-devel.outputs.bake-file }}
${{ steps.meta-universe.outputs.bake-file }}
provenance: false
Expand Down
41 changes: 41 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ RUN rosdep keys --ignore-src --from-paths src \
| sort \
> /rosdep-universe-localization-mapping-depend-packages.txt \
&& cat /rosdep-universe-localization-mapping-depend-packages.txt
RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
> /rosdep-universe-localization-mapping-exec-depend-packages.txt \
&& cat /rosdep-universe-localization-mapping-exec-depend-packages.txt

FROM rosdep-depend AS rosdep-universe-depend
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand Down Expand Up @@ -352,6 +359,40 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

FROM base AS universe-localization-mapping
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG LIB_DIR
ARG SETUP_ARGS

# Set up runtime environment and artifacts
COPY --from=rosdep-universe-localization-mapping-depend /rosdep-universe-localization-mapping-exec-depend-packages.txt /tmp/rosdep-universe-localization-mapping-exec-depend-packages.txt
# hadolint ignore=SC2002
RUN --mount=type=ssh \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \
&& pip uninstall -y ansible ansible-core \
&& apt-get update \
&& cat /tmp/rosdep-universe-localization-mapping-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
&& apt-get autoremove -y && rm -rf "$HOME"/.cache \
&& find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \
&& find / -name "*.o" -type f -delete \
&& find / -name "*.h" -type f -delete \
&& find / -name "*.hpp" -type f -delete \
&& rm -rf /autoware/ansible \
/root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \
/etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \
/usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm*

COPY --from=universe-localization-mapping-devel /opt/autoware /opt/autoware

# Copy bash aliases
COPY docker/etc/.bash_aliases /root/.bash_aliases
RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc

ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

FROM base AS universe
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
Expand Down
4 changes: 4 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ This stage installs the dependency packages based on `/rosdep-universe-localizat
- `universe/autoware.universe/localization`
- `universe/autoware.universe/map`

### `universe-localization-mapping`

This stage is a Autoware Universe Localization/Mapping runtime container. It only includes the dependencies given by `/rosdep-universe-localization-mapping-exec-depend-packages.txt` and the binaries built in the `universe-localization-mapping-devel` stage.

### `universe-devel`

This stage installs the dependency packages based on `/rosdep-universe-depend-packages.txt` and build the remaining packages of `autoware.repos`:
Expand Down
16 changes: 16 additions & 0 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ group "default" {
"core-devel",
"universe-sensing-perception-devel",
"universe-sensing-perception",
"universe-localization-mapping-devel",
"universe-localization-mapping",
"universe-devel",
"universe"
]
Expand All @@ -14,6 +16,8 @@ target "docker-metadata-action-base" {}
target "docker-metadata-action-core-devel" {}
target "docker-metadata-action-universe-sensing-perception-devel" {}
target "docker-metadata-action-universe-sensing-perception" {}
target "docker-metadata-action-universe-localization-mapping-devel" {}
target "docker-metadata-action-universe-localization-mapping" {}
target "docker-metadata-action-universe-devel" {}
target "docker-metadata-action-universe" {}

Expand Down Expand Up @@ -41,6 +45,18 @@ target "universe-sensing-perception" {
target = "universe-sensing-perception"
}

target "universe-localization-mapping-devel" {
inherits = ["docker-metadata-action-universe-localization-mapping-devel"]
dockerfile = "docker/Dockerfile"
target = "universe-localization-mapping-devel"
}

target "universe-localization-mapping" {
inherits = ["docker-metadata-action-universe-localization-mapping"]
dockerfile = "docker/Dockerfile"
target = "universe-localization-mapping"
}

target "universe-devel" {
inherits = ["docker-metadata-action-universe-devel"]
dockerfile = "docker/Dockerfile"
Expand Down

0 comments on commit 2904e9f

Please sign in to comment.