From e1e023bd2ff6c1026da13d1afc08494a471f58de Mon Sep 17 00:00:00 2001 From: Michael Ripperger Date: Mon, 20 Nov 2023 10:46:23 -0600 Subject: [PATCH] Added docker files (#414) --- docker/Dockerfile | 33 +++++++++++++++++++++++++++++++++ docker/README.md | 28 ++++++++++++++++++++++++++++ docker/docker-compose.yml | 14 ++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/README.md create mode 100644 docker/docker-compose.yml diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..2d68b512cb --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,33 @@ +ARG TAG +FROM ghcr.io/tesseract-robotics/tesseract_deploy:${TAG} + +SHELL ["/bin/bash", "-c"] + +ENV DEBIAN_FRONTEND noninteractive + +USER root + +# Install the dependency repositories +# First add the custom apt sources and install additional debians +COPY .github/workflows/add_sources.sh /tmp/add_sources.sh +RUN ./tmp/add_sources.sh \ + && apt install -y \ + libompl-dev \ + taskflow + +# Bind mount the source directory so as not to unnecessarily copy source code into the docker image +ARG WORKSPACE_DIR=/opt/tesseract_planning +RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/tesseract_planning \ + cd ${WORKSPACE_DIR} \ + && vcs import src < src/tesseract_planning/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/tesseract_planning \ + source /opt/tesseract/install/setup.bash \ + && cd ${WORKSPACE_DIR} \ + && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release \ + && rm -rf build log diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000000..9ff1a0a404 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,28 @@ +# Tesseract Planning Docker + +## Create the Docker image +### Download +Download a pre-built Docker image for this bridge from the container registry: + +``` +docker login ghcr.io +docker pull ghcr.io/tesseract-robotics/tesseract_planning_deploy: +``` + +### Build +Build the Docker image using `docker-compose`: + +```commandLine +cd docker +docker compose build +``` + +## Run the docker image +Run the Docker image using `docker-compose`: + +```commandLine +cd docker +CURRENT_UID=$(id -u):$(id -g) docker compose up +``` + +> Note: by default the docker image runs as a non-root user, so the environment variable `CURRENT_UID` must be supplied as shown above \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000000..7d7a94a2ce --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3' +services: + tesseract: + build: + context: .. + dockerfile: docker/Dockerfile + args: + - TAG=focal-0.20 + container_name: tesseract_planning + image: ghcr.io/tesseract-robotics/tesseract_planning_deploy:focal-0.20 + stdin_open: true + tty: true + network_mode: host + user: ${CURRENT_UID} # CURRENT_UID=$(id -u):$(id -g)