-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Docker files for GUI application (#278)
* Added docker files * Added workflow for building docker image * Changed method that java libraries locations are appended to LD_LIBRARY_PATH
- Loading branch information
Showing
5 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- dev | ||
pull_request: | ||
release: | ||
types: | ||
- released | ||
|
||
jobs: | ||
ci: | ||
name: ${{ matrix.os }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [focal, jammy, noble] | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
PUSH_DOCKER_IMAGE: ${{ github.ref == 'refs/heads/master' || github.event_name == 'release' }} | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Docker meta-information | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
latest=false | ||
prefix= | ||
suffix= | ||
tags: | | ||
type=ref,event=branch,prefix=${{ matrix.os }}- | ||
type=ref,event=pr,prefix=${{ matrix.os }}- | ||
type=semver,pattern={{major}}.{{minor}},prefix=${{ matrix.os }}- | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
build-args: | | ||
TAG=${{ matrix.os }} | ||
push: ${{ env.PUSH_DOCKER_IMAGE }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
ARG TAG=jammy | ||
FROM ubuntu:${TAG} | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
USER root | ||
|
||
# Install | ||
RUN apt update \ | ||
&& apt upgrade -y \ | ||
&& apt install -y cmake curl git python3 | ||
|
||
# Add ROS2 sources to install ROS infrastructure tools | ||
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \ | ||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null | ||
|
||
# Install and configure ROS infrastructure tools | ||
RUN apt update \ | ||
&& apt install -y python3-vcstool python3-colcon-common-extensions python3-rosdep \ | ||
&& rosdep init \ | ||
&& rosdep update | ||
|
||
# Bind mount the source directory so as not to unnecessarily copy source code into the docker image | ||
ARG WORKSPACE_DIR=/opt/noether | ||
RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/noether \ | ||
apt update -y -qq \ | ||
&& vcs import ${WORKSPACE_DIR}/src < ${WORKSPACE_DIR}/src/noether/dependencies.repos --shallow \ | ||
&& rosdep install \ | ||
--from-paths ${WORKSPACE_DIR}/src \ | ||
-iry \ | ||
--skip-keys libvtk | ||
|
||
# Build the repository | ||
# Bind mount the source directory so as not to unnecessarily copy source code into the docker image | ||
RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/noether \ | ||
cd ${WORKSPACE_DIR} \ | ||
&& colcon build --cmake-args \ | ||
&& rm -rf build log | ||
|
||
# Set the entrypoint to source the workspace | ||
COPY docker/entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Uncomment for use with GPU | ||
# services: | ||
# noether: | ||
# environment: | ||
# NVIDIA_DRIVER_CAPABILITIES: all | ||
# deploy: | ||
# resources: | ||
# reservations: | ||
# devices: | ||
# - driver: nvidia | ||
# count: 1 | ||
# capabilities: [gpu] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
services: | ||
noether: | ||
build: | ||
context: .. | ||
dockerfile: docker/Dockerfile | ||
args: | ||
TAG: jammy | ||
environment: | ||
DISPLAY: $DISPLAY | ||
XAUTHORITY: $XAUTHORITY | ||
LD_LIBRARY_PATH_ADDITIONS: /usr/lib/jvm/java-11-openjdk-amd64/lib:/usr/lib/jvm/java-11-openjdk-amd64/lib/server | ||
container_name: noether | ||
image: ghcr.io/ros-industrial/noether:jammy | ||
stdin_open: true | ||
tty: true | ||
network_mode: host | ||
privileged: false | ||
user: ${CURRENT_UID} # CURRENT_UID=$(id -u):$(id -g) | ||
volumes: | ||
- /tmp/.X11-unix:/tmp/.X11-unix | ||
# - <path>/<to>/<meshes>:/meshes # Mount a local directory with meshes to /meshes in the docker container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#! /bin/bash | ||
source /opt/noether/install/setup.bash | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH_ADDITIONS | ||
./opt/noether/install/noether_gui/bin/noether_gui_app |