-
Notifications
You must be signed in to change notification settings - Fork 14
70 lines (66 loc) · 2.39 KB
/
docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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 }}