Skip to content

Commit

Permalink
Refactor Dockerfile and CI workflow: streamline Zenoh installation, r…
Browse files Browse the repository at this point in the history
…emove deprecated scripts, and enhance build process for multiple architectures
  • Loading branch information
marc-hanheide committed Dec 12, 2024
1 parent dfef675 commit d6ec64c
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 80 deletions.
48 changes: 37 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ RUN wget -c https://github.com/Neargye/magic_enum/archive/refs/tags/v0.8.0.tar.g
sudo make install &&\
sudo ldconfig &&\
cd ../.. && rm -r magic_enum*
RUN git clone https://github.com/libuvc/libuvc.git &&\
RUN git clone -b 047920bcdfb1dac42424c90de5cc77dfc9fba04d --depth 1 https://github.com/libuvc/libuvc.git &&\
cd libuvc &&\
mkdir build && cd build &&\
cmake .. && make -j4 &&\
Expand All @@ -98,26 +98,52 @@ RUN git clone https://github.com/libuvc/libuvc.git &&\
cd ../.. && rm -r libuvc*


RUN mkdir -p /opt/lcas/extensions
WORKDIR /opt/lcas/extensions
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN git clone https://github.com/eclipse-zenoh/zenoh-plugin-ros2dds.git
WORKDIR /opt/lcas/extensions/zenoh-plugin-ros2dds
RUN bash -c "source '$HOME/.cargo/env'; cargo build --release -p zenoh-bridge-ros2dds"
RUN install target/release/zenoh-bridge-ros2dds /usr/local/bin/
WORKDIR /
# RUN mkdir -p /opt/lcas/extensions
# WORKDIR /opt/lcas/extensions
# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# RUN git clone https://github.com/eclipse-zenoh/zenoh-plugin-ros2dds.git
# WORKDIR /opt/lcas/extensions/zenoh-plugin-ros2dds
# RUN bash -c "source '$HOME/.cargo/env'; cargo build --release -p zenoh-bridge-ros2dds"
# RUN install target/release/zenoh-bridge-ros2dds /usr/local/bin/
# WORKDIR /

# install Zenoh
RUN mkdir -p /tmp/zenoh-build && \
cd /tmp/zenoh-build && \
(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y) && \
git clone --depth 1 -b 1.0.4 https://github.com/eclipse-zenoh/zenoh-plugin-ros2dds.git && \
cd /tmp/zenoh-build/zenoh-plugin-ros2dds && \
/bin/bash -c "source '$HOME/.cargo/env'; cargo build --release -p zenoh-bridge-ros2dds" && \
install target/release/zenoh-bridge-ros2dds /usr/local/bin/


ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

COPY *repos *.sh /tmp/.devcontainer/
COPY .devcontainer/*repos .devcontainer/*.sh /tmp/.devcontainer/

ARG TARGETARCH
ENV TARGETARCH=${TARGETARCH}

RUN bash /tmp/.devcontainer/install.sh

COPY . /opt/ros/lcas/src/limo
RUN apt update && \
rosdep init && \
rosdep --rosdistro=humble update && \
pip install -U argcomplete

RUN cd /opt/ros/lcas && \
rosdep install --from-paths src/ -i -y && \
if [ ${TARGETARCH} = "arm64" ]; then \
# for arm64 we don't have gazebo, so only do bringup and its dependencies
colcon build --packages-up-to limo_bringup; \
else \
colcon build; \
fi

RUN echo "source /opt/ros/humble/setup.bash" >> /etc/bash.bashrc
RUN echo "source /opt/ros/lcas/install/setup.bash" >> /etc/bash.bashrc

RUN cat /tmp/.devcontainer/setup-router.sh >> /etc/bash.bashrc

29 changes: 0 additions & 29 deletions .devcontainer/install.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .devcontainer/lcas.repos

This file was deleted.

100 changes: 65 additions & 35 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,74 @@ on:

jobs:

trigger:
runs-on: ubuntu-latest
# only do this if we don't have a pull request
if: ${{ github.event_name != 'pull_request' }}
# trigger:
# runs-on: ubuntu-latest
# # only do this if we don't have a pull request
# if: ${{ github.event_name != 'pull_request' }}
# steps:
# - uses: lasith-kg/dispatch-workflow@v1
# id: workflow-dispatch_develop
# name: 'Trigger re-build of desktop docker image "develop"'
# with:
# dispatch-method: workflow_dispatch
# repo: kasm-workspaces-core-images
# owner: LCAS
# ref: refs/heads/develop # or main
# workflow: docker-latest.yml # Or Workflow ID
# token: ${{ secrets.ORGA_GH_TOKEN }} # GitHub Token With Relevant Permissions
# - uses: lasith-kg/dispatch-workflow@v1
# id: workflow-dispatch_nvidia_develop
# name: 'Trigger re-build of desktop docker image "nvidia_develop"'
# with:
# dispatch-method: workflow_dispatch
# repo: kasm-workspaces-core-images
# owner: LCAS
# ref: refs/heads/nvidia_develop # or main
# workflow: docker-latest.yml # Or Workflow ID
# token: ${{ secrets.ORGA_GH_TOKEN }} # GitHub Token With Relevant Permissions

build_amd64:

runs-on: lcas

steps:
- uses: lasith-kg/dispatch-workflow@v1
id: workflow-dispatch_develop
name: 'Trigger re-build of desktop docker image "develop"'
- uses: actions/checkout@v3
- name: What
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Docker Login LCAS
# don't attempt to login for PRs
if: ${{ github.event_name != 'pull_request' }}
# You may pin to the exact commit or the version.
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
uses: docker/login-action@v2
with:
dispatch-method: workflow_dispatch
repo: kasm-workspaces-core-images
owner: LCAS
ref: refs/heads/develop # or main
workflow: docker-latest.yml # Or Workflow ID
token: ${{ secrets.ORGA_GH_TOKEN }} # GitHub Token With Relevant Permissions
- uses: lasith-kg/dispatch-workflow@v1
id: workflow-dispatch_nvidia_develop
name: 'Trigger re-build of desktop docker image "nvidia_develop"'
# Server address of Docker registry. If not set then will default to Docker Hub
registry: lcas.lincoln.ac.uk
# Username used to log against the Docker registry
username: ${{ secrets.LCAS_REGISTRY_PUSHER }}
# Password or personal access token used to log against the Docker registry
password: ${{ secrets.LCAS_REGISTRY_TOKEN }}
- name: Docker Login dockerhub
# don't attempt to login for PRs
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
with:
dispatch-method: workflow_dispatch
repo: kasm-workspaces-core-images
owner: LCAS
ref: refs/heads/nvidia_develop # or main
workflow: docker-latest.yml # Or Workflow ID
token: ${{ secrets.ORGA_GH_TOKEN }} # GitHub Token With Relevant Permissions
# Username used to log against the Docker registry
username: ${{ secrets.DOCKERHUB_USER }}
# Password or personal access token used to log against the Docker registry
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push limo_ros2 for amd64
uses: docker/build-push-action@v5
with:
context: .
file: .devcontainer/Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: lcas.lincoln.ac.uk/lcas/limo_ros_amd64:${{ env.BRANCH }}
build-args: |
BRANCH=${{ env.BRANCH }}
build:
build_arm64:

runs-on: lcas

Expand Down Expand Up @@ -77,21 +118,10 @@ jobs:
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v5
with:
context: .devcontainer
context: .
file: .devcontainer/Dockerfile
platforms: linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: lcas.lincoln.ac.uk/lcas/limo_ros_arm64:${{ env.BRANCH }}
build-args: |
BRANCH=${{ env.BRANCH }}
- name: Build and push limo_ros2 for amd64
uses: docker/build-push-action@v5
with:
context: .devcontainer
file: .devcontainer/Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: lcas.lincoln.ac.uk/lcas/limo_ros_amd64:${{ env.BRANCH }}
build-args: |
BRANCH=${{ env.BRANCH }}

0 comments on commit d6ec64c

Please sign in to comment.