Skip to content

Commit

Permalink
feat(docker): add universe-sensing-perception runtime stage (#5172)
Browse files Browse the repository at this point in the history
* rename stages

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* update docker-bake

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* update actions

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* fix target

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* fix inherits

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* feat(docker): separation from `autoware-universe` stage to `autoware-universe-sensing-perception` stage (#5164)

* split depend stage

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* add s/p stage

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* fix

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* rename

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* fix

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* revert rename

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* Revert "revert rename"

This reverts commit 789ee21.

* simplify rosdep-depend

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

---------

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* fix rebase

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* rename stages

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* fix bake

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* fix dockerfile

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* fix merge

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* add universe-sensing-perception stage

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* update config

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

---------

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>
  • Loading branch information
youtalk authored Sep 6, 2024
1 parent 7148b77 commit 7a3def5
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
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 @@ -111,6 +111,28 @@ runs:
latest=false
suffix=-core-devel${{ inputs.tag-suffix }}
- name: Docker meta for autoware:universe-sensing-perception-devel
id: meta-universe-sensing-perception-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-sensing-perception-devel
flavor: |
latest=false
suffix=-universe-sensing-perception-devel${{ inputs.tag-suffix }}
- name: Docker meta for autoware:universe-sensing-perception
id: meta-universe-sensing-perception
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-sensing-perception
flavor: |
latest=false
suffix=-universe-sensing-perception${{ inputs.tag-suffix }}
- name: Docker meta for autoware:universe-devel
id: meta-universe-devel
uses: docker/metadata-action@v5
Expand Down Expand Up @@ -148,6 +170,8 @@ runs:
docker/docker-bake.hcl
${{ steps.meta-base.outputs.bake-file }}
${{ 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-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 @@ -85,6 +85,13 @@ RUN rosdep keys --ignore-src --from-paths src \
| sort \
> /rosdep-universe-sensing-perception-depend-packages.txt \
&& cat /rosdep-universe-sensing-perception-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-sensing-perception-exec-depend-packages.txt \
&& cat /rosdep-universe-sensing-perception-exec-depend-packages.txt

COPY src/launcher /autoware/src/launcher
COPY src/param /autoware/src/param
Expand Down Expand Up @@ -258,6 +265,40 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

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

# Set up runtime environment and artifacts
COPY --from=rosdep-depend /rosdep-universe-sensing-perception-exec-depend-packages.txt /tmp/rosdep-universe-sensing-perception-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} --download-artifacts --no-cuda-drivers --runtime openadkit \
&& pip uninstall -y ansible ansible-core \
&& apt-get update \
&& cat /tmp/rosdep-universe-sensing-perception-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-sensing-perception-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
23 changes: 22 additions & 1 deletion docker/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
group "default" {
targets = ["base", "core-devel", "universe-devel", "universe"]
targets = [
"base",
"core-devel",
"universe-sensing-perception-devel",
"universe-sensing-perception",
"universe-devel",
"universe"
]
}

// For docker/metadata-action
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-devel" {}
target "docker-metadata-action-universe" {}

Expand All @@ -20,6 +29,18 @@ target "core-devel" {
target = "core-devel"
}

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

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

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

0 comments on commit 7a3def5

Please sign in to comment.