diff --git a/.github/workflows/ci-image.yml b/.github/workflows/ci-image.yml new file mode 100644 index 0000000..50bf8e2 --- /dev/null +++ b/.github/workflows/ci-image.yml @@ -0,0 +1,65 @@ + +name: Build CI Image + +on: + pull_request: + paths: + - "containers/ci/**" + - ".github/workflows/ci-image.yml" + + push: + branches: + - main + paths: + - "containers/ci/**" + - ".github/workflows/ci-image.yml" + + workflow_dispatch: + +permissions: + contents: read + +env: + REGISTRY: ghcr.io + IMAGE_NAME: openamrobot/ci-ros2-jazzy + +jobs: + build-and-push: + name: Build CI image + runs-on: ubuntu-24.04 + + permissions: + contents: read + packages: write + + steps: + - name: Check out repository + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 + + - name: Log in to GHCR + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build CI image and publish from main + id: build + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 + with: + context: . + file: containers/ci/Dockerfile + push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} + + - name: Print published image digest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + run: | + echo "Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" + echo "Digest: ${{ steps.build.outputs.digest }}" diff --git a/containers/ci/Dockerfile b/containers/ci/Dockerfile new file mode 100644 index 0000000..3e3c540 --- /dev/null +++ b/containers/ci/Dockerfile @@ -0,0 +1,45 @@ +FROM ros:jazzy-ros-base@sha256:066420e07f60aa18262f2479981def87ebcfcec42eefb0c0c57c4a46098348ca + +ARG DEBIAN_FRONTEND=noninteractive + +# Common CI and ROS workspace tooling +RUN apt-get update && apt-get install -y --no-install-recommends \ + python3-colcon-common-extensions \ + python3-rosdep \ + python3-vcstool \ + git \ + curl \ + \ + # Platform ROS dependencies \ + ros-jazzy-nav2-bringup \ + ros-jazzy-nav2-common \ + ros-jazzy-slam-toolbox \ + ros-jazzy-nav2-bt-navigator \ + ros-jazzy-nav2-behaviors \ + ros-jazzy-nav2-controller \ + ros-jazzy-nav2-lifecycle-manager \ + ros-jazzy-nav2-map-server \ + ros-jazzy-nav2-amcl \ + ros-jazzy-nav2-planner \ + ros-jazzy-nav2-smoother \ + ros-jazzy-nav2-waypoint-follower \ + ros-jazzy-nav2-velocity-smoother \ + ros-jazzy-nav2-collision-monitor \ + ros-jazzy-opennav-docking \ + ros-jazzy-laser-filters \ + ros-jazzy-rviz2 \ + ros-jazzy-camera-ros \ + ros-jazzy-joint-state-publisher \ + ros-jazzy-joint-state-publisher-gui \ + ros-jazzy-xacro \ + ros-jazzy-ros-gz-sim \ + ros-jazzy-ros-gz-bridge \ + ros-jazzy-apriltag-msgs \ + ros-jazzy-apriltag-ros \ + ros-jazzy-nav2-msgs \ + ros-jazzy-robot-localization \ + ros-jazzy-topic-tools \ + ros-jazzy-rmw-cyclonedds-cpp \ + && rm -rf /var/lib/apt/lists/* + +ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp \ No newline at end of file