Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docker): inherite autoware-base images #142

Closed
wants to merge 19 commits into from
Closed
2 changes: 2 additions & 0 deletions .github/workflows/health-check-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

docker-build:
needs: load-env
runs-on: buildjet-16vcpu-ubuntu-2204-arm

Check warning on line 14 in .github/workflows/health-check-arm64.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (buildjet)

Check warning on line 14 in .github/workflows/health-check-arm64.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (vcpu)
steps:
# https://github.com/actions/checkout/issues/211
- name: Change permission of workspace
Expand All @@ -34,6 +34,8 @@
build-args: |
ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }}
BASE_IMAGE=${{ needs.load-env.outputs.base_image }}
AUTOWARE_BASE_IMAGE=${{ needs.load-env.outputs.autoware_base_image }}
AUTOWARE_BASE_CUDA_IMAGE=${{ needs.load-env.outputs.autoware_base_cuda_image }}
LIB_DIR=aarch64

- name: Show disk space
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/health-check-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

docker-build-nightly:
needs: load-env
runs-on: buildjet-16vcpu-ubuntu-2204

Check warning on line 29 in .github/workflows/health-check-nightly.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (buildjet)

Check warning on line 29 in .github/workflows/health-check-nightly.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (vcpu)
strategy:
fail-fast: false
steps:
Expand All @@ -50,6 +50,8 @@
build-args: |
ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }}
BASE_IMAGE=${{ needs.load-env.outputs.base_image }}
AUTOWARE_BASE_IMAGE=${{ needs.load-env.outputs.autoware_base_image }}
AUTOWARE_BASE_CUDA_IMAGE=${{ needs.load-env.outputs.autoware_base_cuda_image }}
LIB_DIR=x86_64

- name: Show disk space
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/health-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

docker-build:
needs: load-env
runs-on: buildjet-16vcpu-ubuntu-2204

Check warning on line 29 in .github/workflows/health-check.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (buildjet)

Check warning on line 29 in .github/workflows/health-check.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (vcpu)
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand All @@ -44,6 +44,8 @@
build-args: |
ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }}
BASE_IMAGE=${{ needs.load-env.outputs.base_image }}
AUTOWARE_BASE_IMAGE=${{ needs.load-env.outputs.autoware_base_image }}
AUTOWARE_BASE_CUDA_IMAGE=${{ needs.load-env.outputs.autoware_base_cuda_image }}
LIB_DIR=x86_64

- name: Show disk space
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/load-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@ name: load-env
on:
workflow_call:
outputs:
base_image:
value: ${{ jobs.load-env.outputs.base_image }}
rosdistro:
value: ${{ jobs.load-env.outputs.rosdistro }}
base_image:
value: ${{ jobs.load-env.outputs.base_image }}
autoware_base_image:
value: ${{ jobs.load-env.outputs.autoware_base_image }}
autoware_base_cuda_image:
value: ${{ jobs.load-env.outputs.autoware_base_cuda_image }}

jobs:
load-env:
runs-on: ubuntu-22.04
outputs:
base_image: ${{ steps.set-env.outputs.base_image }}
rosdistro: ${{ steps.set-env.outputs.rosdistro }}
base_image: ${{ steps.set-env.outputs.base_image }}
autoware_base_image: ${{ steps.set-env.outputs.autoware_base_image }}
autoware_base_cuda_image: ${{ steps.set-env.outputs.autoware_base_cuda_image }}
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand All @@ -28,5 +34,7 @@ jobs:
- name: Set env
id: set-env
run: |
echo "base_image=${{ env.base_image }}" >> $GITHUB_OUTPUT
echo "rosdistro=${{ env.rosdistro }}" >> $GITHUB_OUTPUT
echo "base_image=${{ env.base_image }}" >> $GITHUB_OUTPUT
echo "autoware_base_image=${{ env.autoware_base_image }}" >> $GITHUB_OUTPUT
echo "autoware_base_cuda_image=${{ env.autoware_base_cuda_image }}" >> $GITHUB_OUTPUT
2 changes: 2 additions & 0 deletions amd64.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
rosdistro=humble
rmw_implementation=rmw_cyclonedds_cpp
base_image=ros:humble-ros-base-jammy
autoware_base_image=ghcr.io/youtalk/autoware-base:latest
autoware_base_cuda_image=ghcr.io/youtalk/autoware-base:cuda-latest
cuda_version=12.3
cudnn_version=8.9.5.29-1+cuda12.2
tensorrt_version=8.6.1.6-1+cuda12.0
Expand Down
74 changes: 18 additions & 56 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,52 +1,6 @@
ARG BASE_IMAGE

# hadolint ignore=DL3006
FROM $BASE_IMAGE AS base
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO

# Copy files
COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/
COPY ansible/ /autoware/ansible/
COPY docker/scripts/cleanup_apt.sh /autoware/cleanup_apt.sh
RUN chmod +x /autoware/cleanup_apt.sh
COPY docker/scripts/cleanup_system.sh /autoware/cleanup_system.sh
RUN chmod +x /autoware/cleanup_system.sh
WORKDIR /autoware

# Install apt packages and add GitHub to known hosts for private repositories
RUN rm -f /etc/apt/apt.conf.d/docker-clean \
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
gosu \
ssh \
&& /autoware/cleanup_apt.sh \
&& mkdir -p ~/.ssh \
&& ssh-keyscan github.com >> ~/.ssh/known_hosts

# Set up base environment
RUN --mount=type=ssh \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
./setup-dev-env.sh -y --module base --no-nvidia --no-cuda-drivers --runtime openadkit \
&& pip uninstall -y ansible ansible-core \
&& /autoware/cleanup_apt.sh \
&& 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
CMD ["/bin/bash"]

FROM base AS base-cuda
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Set up CUDA runtime environment and artifacts
# hadolint ignore=SC2002
RUN --mount=type=ssh \
./setup-dev-env.sh -y --module base --download-artifacts --no-cuda-drivers --runtime openadkit \
&& pip uninstall -y ansible ansible-core \
&& /autoware/cleanup_apt.sh true
ARG AUTOWARE_BASE_IMAGE
ARG AUTOWARE_BASE_CUDA_IMAGE

# hadolint ignore=DL3006
FROM $BASE_IMAGE AS rosdep-depend
Expand Down Expand Up @@ -158,7 +112,8 @@ RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \
> /rosdep-exec-depend-packages.txt \
&& cat /rosdep-exec-depend-packages.txt

FROM base AS core-devel
# hadolint ignore=DL3006
FROM $AUTOWARE_BASE_IMAGE AS core-devel
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ENV CCACHE_DIR="/root/.ccache"
Expand Down Expand Up @@ -413,7 +368,8 @@ COPY --from=universe-devel /opt/autoware /opt/autoware
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

FROM base AS universe-sensing-perception
# hadolint ignore=DL3006
FROM $AUTOWARE_BASE_IMAGE AS universe-sensing-perception
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG LIB_DIR
Expand All @@ -438,7 +394,8 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

FROM base-cuda AS universe-sensing-perception-cuda
# hadolint ignore=DL3006
FROM $AUTOWARE_BASE_CUDA_IMAGE AS universe-sensing-perception-cuda
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG LIB_DIR
Expand All @@ -459,7 +416,8 @@ COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

FROM base AS universe-localization-mapping
# hadolint ignore=DL3006
FROM $AUTOWARE_BASE_IMAGE AS universe-localization-mapping
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG LIB_DIR
Expand All @@ -484,7 +442,8 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

FROM base AS universe-planning-control
# hadolint ignore=DL3006
FROM $AUTOWARE_BASE_IMAGE AS universe-planning-control
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG LIB_DIR
Expand All @@ -509,7 +468,8 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

FROM base AS universe-vehicle-system
# hadolint ignore=DL3006
FROM $AUTOWARE_BASE_IMAGE AS universe-vehicle-system
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG LIB_DIR
Expand All @@ -534,7 +494,8 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

FROM base AS universe
# hadolint ignore=DL3006
FROM $AUTOWARE_BASE_IMAGE AS universe
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG LIB_DIR
Expand All @@ -559,7 +520,8 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

FROM base-cuda AS universe-cuda
# hadolint ignore=DL3006
FROM $AUTOWARE_BASE_CUDA_IMAGE AS universe-cuda
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG LIB_DIR
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /auto
COPY ansible/ /autoware/ansible/
COPY docker/scripts/cleanup_apt.sh /autoware/cleanup_apt.sh
RUN chmod +x /autoware/cleanup_apt.sh
COPY docker/scripts/cleanup_system.sh /autoware/cleanup_system.sh
RUN chmod +x /autoware/cleanup_system.sh
WORKDIR /autoware

# Install apt packages and add GitHub to known hosts for private repositories
Expand Down
Loading