Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into upstream-to-origin
Browse files Browse the repository at this point in the history
  • Loading branch information
youtalk committed Sep 6, 2024
2 parents ce076c1 + 7a3def5 commit 1a71f6a
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 57 deletions.
54 changes: 33 additions & 21 deletions .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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 }}
4 changes: 4 additions & 0 deletions autoware.repos
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
72 changes: 53 additions & 19 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand All @@ -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"]
48 changes: 31 additions & 17 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -1,40 +1,54 @@
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"]
dockerfile = "docker/Dockerfile"
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"
}

0 comments on commit 1a71f6a

Please sign in to comment.