diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 6ca62218712..1d30b4b5a57 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -92,7 +92,7 @@ runs: echo "$EOF" >> $GITHUB_OUTPUT shell: bash - - name: Docker meta for base + - name: Docker meta for autoware:base id: meta-base uses: docker/metadata-action@v5 with: @@ -103,49 +103,60 @@ runs: latest=false suffix=-base${{ inputs.tag-suffix }} - - name: Docker meta for autoware-core - id: meta-autoware-core + - name: Docker meta for autoware:core-devel + id: meta-core-devel uses: docker/metadata-action@v5 with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: ${{ steps.set-docker-tags.outputs.tags }} - bake-target: docker-metadata-action-autoware-core + bake-target: docker-metadata-action-core-devel flavor: | latest=false - suffix=-autoware-core${{ inputs.tag-suffix }} + suffix=-core-devel${{ inputs.tag-suffix }} - - name: Docker meta for autoware-universe - id: meta-autoware-universe + - name: Docker meta for autoware:universe-sensing-perception-devel + id: meta-universe-sensing-perception-devel uses: docker/metadata-action@v5 with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: ${{ steps.set-docker-tags.outputs.tags }} - bake-target: docker-metadata-action-autoware-universe + bake-target: docker-metadata-action-universe-sensing-perception-devel flavor: | latest=false - suffix=-autoware-universe${{ inputs.tag-suffix }} + suffix=-universe-sensing-perception-devel${{ inputs.tag-suffix }} - - name: Docker meta for devel - id: meta-devel + - name: Docker meta for autoware:universe-sensing-perception + id: meta-universe-sensing-perception uses: docker/metadata-action@v5 with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: ${{ steps.set-docker-tags.outputs.tags }} - bake-target: docker-metadata-action-devel + bake-target: docker-metadata-action-universe-sensing-perception flavor: | latest=false - suffix=-devel${{ inputs.tag-suffix }} + suffix=-universe-sensing-perception${{ inputs.tag-suffix }} - - name: Docker meta for runtime - id: meta-runtime + - name: Docker meta for autoware:universe-devel + id: meta-universe-devel uses: docker/metadata-action@v5 with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: ${{ steps.set-docker-tags.outputs.tags }} - bake-target: docker-metadata-action-runtime + bake-target: docker-metadata-action-universe-devel + flavor: | + latest=false + suffix=-universe-devel${{ inputs.tag-suffix }} + + - name: Docker meta for autoware:universe + id: meta-universe + 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 flavor: | latest=auto - suffix=-runtime${{ inputs.tag-suffix }} + suffix=-universe${{ inputs.tag-suffix }} - name: Login to Docker Hub uses: docker/login-action@v3 @@ -160,10 +171,11 @@ runs: files: | docker/docker-bake.hcl ${{ steps.meta-base.outputs.bake-file }} - ${{ steps.meta-autoware-core.outputs.bake-file }} - ${{ steps.meta-autoware-universe.outputs.bake-file }} - ${{ steps.meta-devel.outputs.bake-file }} - ${{ steps.meta-runtime.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 set: | ${{ inputs.build-args }} diff --git a/autoware.repos b/autoware.repos index e9795ef8456..9abd0d21826 100644 --- a/autoware.repos +++ b/autoware.repos @@ -133,6 +133,10 @@ repositories: type: git url: https://github.com/autowarefoundation/sample_vehicle_launch.git version: main + vehicle/awsim_labs_vehicle_launch: + type: git + url: https://github.com/autowarefoundation/awsim_labs_vehicle_launch.git + version: main vehicle/external/pacmod_interface: type: git url: https://github.com/tier4/pacmod_interface.git diff --git a/docker/Dockerfile b/docker/Dockerfile index f053916daea..9e62ce5a02e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -31,6 +31,9 @@ RUN --mount=type=ssh \ && echo "source /opt/ros/${ROS_DISTRO}/setup.bash" > /etc/bash.bashrc # Create entrypoint +COPY docker/etc/ros_entrypoint.sh /ros_entrypoint.sh +RUN chmod +x /ros_entrypoint.sh +ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] # hadolint ignore=DL3006 @@ -82,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 @@ -105,15 +115,16 @@ RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ > /rosdep-exec-depend-packages.txt \ && cat /rosdep-exec-depend-packages.txt -FROM base AS autoware-core +FROM base AS core-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" -# Set up development environment +# Set up development environment and tools RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ ./setup-dev-env.sh -y --module all openadkit \ + && ./setup-dev-env.sh -y --module dev-tools openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && rm -rf "$HOME"/.cache @@ -138,7 +149,10 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ && du -sh ${CCACHE_DIR} && ccache -s \ && rm -rf /autoware/build -FROM autoware-core AS autoware-universe-common +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + +FROM core-devel AS universe-common-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" @@ -170,7 +184,10 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ && du -sh ${CCACHE_DIR} && ccache -s \ && rm -rf /autoware/build -FROM autoware-universe-common AS autoware-universe-sensing-perception +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + +FROM universe-common-devel AS universe-sensing-perception-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" @@ -199,9 +216,10 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ && du -sh ${CCACHE_DIR} && ccache -s \ && rm -rf /autoware/build +ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] -FROM autoware-universe-common AS autoware-universe +FROM universe-common-devel AS universe-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" @@ -214,7 +232,7 @@ RUN --mount=type=ssh \ && cat /tmp/rosdep-universe-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache -COPY --from=autoware-universe-sensing-perception /opt/autoware /opt/autoware +COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-depend,source=/autoware/src/launcher,target=/autoware/src/launcher \ @@ -244,25 +262,44 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ && du -sh ${CCACHE_DIR} && ccache -s \ && rm -rf /autoware/build +ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] -FROM autoware-universe AS devel +FROM base AS universe-sensing-perception SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ARG LIB_DIR +ARG SETUP_ARGS -# Install development tools and artifacts +# 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 dev-tools openadkit \ + ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache + && 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 -# Create entrypoint -COPY docker/etc/ros_entrypoint.sh /ros_entrypoint.sh -RUN chmod +x /ros_entrypoint.sh ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] -FROM base AS runtime +FROM base AS universe SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR @@ -287,14 +324,11 @@ RUN --mount=type=ssh \ /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=autoware-universe /opt/autoware /opt/autoware +COPY --from=universe-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 -# Create entrypoint -COPY docker/etc/ros_entrypoint.sh /ros_entrypoint.sh -RUN chmod +x /ros_entrypoint.sh ENTRYPOINT ["/ros_entrypoint.sh"] -CMD ["bash"] +CMD ["/bin/bash"] diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index 9e3fb6536a7..4360c907329 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -1,13 +1,21 @@ group "default" { - targets = ["base", "autoware-core", "autoware-universe", "devel", "runtime"] + 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-autoware-core" {} -target "docker-metadata-action-autoware-universe" {} -target "docker-metadata-action-devel" {} -target "docker-metadata-action-runtime" {} +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" {} target "base" { inherits = ["docker-metadata-action-base"] @@ -15,26 +23,32 @@ target "base" { target = "base" } -target "autoware-core" { - inherits = ["docker-metadata-action-autoware-core"] +target "core-devel" { + inherits = ["docker-metadata-action-core-devel"] dockerfile = "docker/Dockerfile" - target = "autoware-core" + target = "core-devel" } -target "autoware-universe" { - inherits = ["docker-metadata-action-autoware-universe"] +target "universe-sensing-perception-devel" { + inherits = ["docker-metadata-action-universe-sensing-perception-devel"] dockerfile = "docker/Dockerfile" - target = "autoware-universe" + target = "universe-sensing-perception-devel" } -target "devel" { - inherits = ["docker-metadata-action-devel"] +target "universe-sensing-perception" { + inherits = ["docker-metadata-action-universe-sensing-perception"] dockerfile = "docker/Dockerfile" - target = "devel" + target = "universe-sensing-perception" } -target "runtime" { - inherits = ["docker-metadata-action-runtime"] +target "universe-devel" { + inherits = ["docker-metadata-action-universe-devel"] dockerfile = "docker/Dockerfile" - target = "runtime" + target = "universe-devel" +} + +target "universe" { + inherits = ["docker-metadata-action-universe"] + dockerfile = "docker/Dockerfile" + target = "universe" }