Skip to content

Commit

Permalink
Added Dockerfile and docker compose files
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSpielman committed Dec 6, 2024
1 parent b3c8d6b commit d406381
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
ARG TAG=jammy
FROM ubuntu:${TAG}

ARG ROS_DISTRO

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/industrial_calibration
RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/industrial_calibration \
apt update -y -qq \
&& vcs import ${WORKSPACE_DIR}/src < ${WORKSPACE_DIR}/src/industrial_calibration/dependencies.repos --shallow \
&& rosdep install \
--from-paths ${WORKSPACE_DIR}/src \
-iry

# 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/industrial_calibration \
cd ${WORKSPACE_DIR} \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release \
&& rm -rf build log

# Set the entrypoint to source the workspace
COPY docker/extrinsic_calibration_gui.sh /extrinsic_calibration_gui.sh
COPY docker/intrinsic_calibration_gui.sh /intrinsic_calibration_gui.sh


ENTRYPOINT ["/extrinsic_calibration_gui"]
36 changes: 36 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
services:
industrial_calibration:
build:
context: ..
dockerfile: docker/Dockerfile
args:
TAG: jammy
ROS_DISTRO: humble
environment:
DISPLAY: $DISPLAY
XAUTHORITY: $XAUTHORITY
NVIDIA_DRIVER_CAPABILITIES: all
ROS_LOG_DIR: /tmp
container_name: industrial_calibration
image: ghcr.io/ros-industrial/industrial_calibration: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
- /etc/hosts:/etc/hosts
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro

# entrypoint: /extrinsic_calibration_gui.sh
entrypoint: /intrinsic_calibration_gui.sh

deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
3 changes: 3 additions & 0 deletions docker/extrinsic_calibration_gui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source /opt/industrial_calibration/install/setup.bash
./opt/industrial_calibration/install/industrial_calibration/bin/industrial_calibration_extrinsic_hand_eye_calibration_app
3 changes: 3 additions & 0 deletions docker/intrinsic_calibration_gui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source /opt/industrial_calibration/install/setup.bash
./opt/industrial_calibration/install/industrial_calibration/bin/industrial_calibration_camera_intrinsic_calibration_app

0 comments on commit d406381

Please sign in to comment.