Skip to content

Docker

Docker #121

Workflow file for this run

name: Docker
on:
schedule:
# 6 AM UTC every Sunday
- cron: "0 6 * * 6"
workflow_dispatch:
push:
branches:
- noetic-devel
paths:
- '**/package.xml'
- .docker
- .dockignore
- .github/workflows/docker.yml
- .github/workflows/*.rosinstall
concurrency: # cancel any previous workflow(s) from the same PR or branch/tag
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
ci:
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [noetic, one]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
IMAGE: ubiagni/mujoco_ros:${{ matrix.ROS_DISTRO }}-${{ github.job }}
MUJOCO_VERSIONS: 3.2.0
steps:
- name: Check for apt updates
uses: rhaschke/docker-run-action@main
continue-on-error: true
id: apt
with:
image: ${{ env.IMAGE }}
shell: bash
run: |
apt-get update
have_updates=$(apt-get --simulate upgrade | grep -q "^0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.$" && echo false || echo true)
echo "no_cache=$have_updates" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name != 'schedule' || steps.apt.outputs.no_cache }}
- name: Login to Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name != 'schedule' || steps.apt.outputs.no_cache }}
with:
file: .docker/Dockerfile
build-args: |
ROS_DISTRO=${{ matrix.ROS_DISTRO }}
BASE_DOCKER_NAME=${{ matrix.ROS_DISTRO == 'one' && 'jammy' || matrix.ROS_DISTRO }}
MUJOCO_VERSIONS=${{ env.MUJOCO_VERSIONS }}
IMAGE_PREFIX=${{ matrix.ROS_DISTRO == 'one' && 'ubiagni/' || '' }}
push: true
no-cache: ${{ steps.apt.outputs.no_cache || github.event_name == 'workflow_dispatch' }}
cache-from: type=registry,ref=${{ env.IMAGE }}
cache-to: type=inline
tags: ${{ env.IMAGE }}