Skip to content

Commit

Permalink
Add docker CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Armstrong committed Nov 21, 2023
1 parent 8a63a60 commit 54279dc
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
63 changes: 63 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Docker

on:
push:
branches:
- master
pull_request:
paths:
- 'docker/Dockerfile'
- '.github/workflows/docker.yml'
release:
types:
- released

jobs:
ci:
name: ${{ matrix.distro }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
distro: [focal, jammy]
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.distro }}-
type=raw,event=pr,prefix=${{ matrix.distro }}-,value=master
type=semver,pattern={{major}}.{{minor}},prefix=${{ matrix.distro }}-
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
build-args: TAG=${{ steps.meta.outputs.version }}
push: ${{ env.PUSH_DOCKER_IMAGE }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 7 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
ARG TAG
FROM ghcr.io/tesseract-robotics/tesseract_planning_deploy:${TAG}
FROM ghcr.io/tesseract-robotics/tesseract_planning:${TAG}

SHELL ["/bin/bash", "-c"]

ENV DEBIAN_FRONTEND noninteractive

USER root

# Install the dependency
COPY .add-gazebo-ppa /tmp/add_gazebo_ppa.sh
RUN ./tmp/add_gazebo_ppa.sh \
&& apt install -y qt-advanced-docking-system libgz-rendering7-dev libgz-common5-dev libgz-math7-dev

# Bind mount the source directory so as not to unnecessarily copy source code into the docker image
ARG WORKSPACE_DIR=/opt/tesseract_qt
RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/tesseract_qt \
Expand All @@ -18,6 +23,7 @@ RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/tesseract_qt \
# 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_qt \
source /opt/tesseract/install/setup.bash \
source /opt/tesseract_planning/install/setup.bash \
&& cd ${WORKSPACE_DIR} \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_RENDERING=OFF -DBUILD_STUDIO=OFF \
Expand Down

0 comments on commit 54279dc

Please sign in to comment.