diff --git a/.github/workflows/autoware_runtime.yml b/.github/workflows/autoware_runtime.yml new file mode 100644 index 0000000..e9ef527 --- /dev/null +++ b/.github/workflows/autoware_runtime.yml @@ -0,0 +1,43 @@ +name: Build Autoware runtime image +on: + workflow_dispatch: + schedule: + - cron: '41 8 * * *' # Every day at 8:41 UTC + push: + paths: + - containers/autoware-runtime/Dockerfile + - .github/workflows/autoware_runtime.yml # Self-trigger + +env: + REGISTRY: ghcr.io + IMAGE_NAME: bounverif/autoware-runtime + VERSION: latest + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Log in to the registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push image + uses: docker/build-push-action@v4 + with: + context: containers/autoware-runtime + build-args: | + VERSION=${{ env.VERSION }} + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} + push: true + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/containers/autoware-runtime/Dockerfile b/containers/autoware-runtime/Dockerfile new file mode 100644 index 0000000..796ff8a --- /dev/null +++ b/containers/autoware-runtime/Dockerfile @@ -0,0 +1,45 @@ +FROM ghcr.io/bounverif/autoware-prebuilt:latest as prebuilt +FROM ros:humble-ros-base-jammy + +ARG CUDA_ARCH=x86_64 +ARG CUDA_DISTRO=ubuntu2204 +ARG CUDA_KEYRING_PACKAGE=cuda-keyring_1.1-1_all.deb +ARG CUDA_KEYRING_FILEPATH=https://developer.download.nvidia.com/compute/cuda/repos/${CUDA_DISTRO}/${CUDA_ARCH}/${CUDA_KEYRING_PACKAGE} + +ENV NVIDIA_VISIBLE_DEVICES=all +ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility + +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install \ + git \ + wget \ + tini \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* + +RUN wget ${CUDA_KEYRING_FILEPATH} && dpkg -i ${CUDA_KEYRING_PACKAGE} && rm ${CUDA_KEYRING_PACKAGE} + +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install \ + libcublas-12-2 \ + libcurand-12-2 \ + cuda-cudart-12-2 \ + libnvinfer8 \ + libnvinfer-plugin8 \ + libnvparsers8 \ + libnvonnxparsers8 \ + && find . -name 'libcu*.a' -delete \ + && find . -name 'libnv*.a' -delete \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* + +# Copy Autoware build artifacts +COPY --from=prebuilt /opt/autoware/humble /opt/autoware/humble + +# Copy the script to the container +COPY ./entrypoint.sh / +RUN chmod +x /entrypoint.sh + +# Tini correctly initialize the shell in the container +# With the -g option, tini kills the child process group. +# This corresponds more closely to what happens when you do ctrl-C +# See: https://github.com/krallin/tini +ENTRYPOINT ["tini", "-g", "--", "/entrypoint.sh"] diff --git a/containers/autoware-runtime/entrypoint.sh b/containers/autoware-runtime/entrypoint.sh new file mode 100644 index 0000000..81d1cd3 --- /dev/null +++ b/containers/autoware-runtime/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Trigger an error if non-zero exit code is encountered +set -e + +# Source Autoware environment +source /opt/autoware/humble/setup.bash + +# Execute the command +exec ros2 launch "${@}"