Skip to content

Rework POSIM documentation, installation routes and simulation behavior #158

Rework POSIM documentation, installation routes and simulation behavior

Rework POSIM documentation, installation routes and simulation behavior #158

---
name: Build Lyrical / Jetty Docker image (ARM64)
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
pull_request:
branches: [main]
paths:
- ".docker/**"
- ".dockerignore"
- ".github/workflows/docker-arm64v8.yml"
- "posim_interfaces/**"
- "examples/**"
- "extras/**"
- "gazebo/**"
- "models/**"
- "README.md"
push:
tags: ["v*"]
branches: [main]
env:
IMAGE_NAME: ioeslab/posim
ROS_DISTRO: lyrical
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-and-push-to-docker-hub:
# Keep container builds off the shared simulation host. Fork builds still
# require repository approval and never receive publication credentials.
if: >-
vars.POSIM_ENABLE_DOCKER_CI == 'true' &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-24.04-arm
timeout-minutes: 1440
permissions:
contents: read
packages: write
steps:
- name: Configure non-interactive Docker credentials
run: |
# Read the selected daemon before isolating credentials. A new
# DOCKER_CONFIG otherwise loses Docker Desktop's desktop-linux context
# and falls back to the absent /var/run/docker.sock on macOS.
docker_host="${DOCKER_HOST:-$(docker context inspect --format '{{.Endpoints.docker.Host}}')}"
docker_config="$RUNNER_TEMP/docker-config"
mkdir -p "$docker_config"
chmod 700 "$docker_config"
printf '{}\n' > "$docker_config/config.json"
chmod 600 "$docker_config/config.json"
echo "DOCKER_HOST=$docker_host" >> "$GITHUB_ENV"
echo "DOCKER_CONTEXT=" >> "$GITHUB_ENV"
echo "DOCKER_CONFIG=$docker_config" >> "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
with:
# Use native ARM64 Docker for this single-platform build.
driver: docker
- name: Configure Docker Hub authentication
if: vars.POSIM_PUBLISH_IMAGES == 'true' && github.event_name != 'pull_request'
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
# Avoid Docker Desktop's interactive macOS Keychain helper. BuildKit
# reads this short-lived Docker config directly during the push.
python3 - <<'PY'
import base64
import json
import os
from pathlib import Path
raw = f"{os.environ['DOCKERHUB_USERNAME']}:{os.environ['DOCKERHUB_TOKEN']}"
auth = base64.b64encode(raw.encode()).decode()
config = {"auths": {"https://index.docker.io/v1/": {"auth": auth}}}
path = Path(os.environ["DOCKER_CONFIG"]) / "config.json"
path.write_text(json.dumps(config), encoding="utf-8")
path.chmod(0o600)
PY
- name: Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.IMAGE_NAME }}
flavor: |
latest=false
suffix=-arm64-rdp
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build Docker image
uses: docker/build-push-action@v7
with:
context: .
push: ${{ vars.POSIM_PUBLISH_IMAGES == 'true' && github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: .docker/lyrical.arm64v8.dockerfile
platforms: linux/arm64/v8
build-args: |
ROS_DISTRO=${{ env.ROS_DISTRO }}
- name: Clear Docker Hub credentials
if: always() && vars.POSIM_PUBLISH_IMAGES == 'true' && github.event_name != 'pull_request'
run: printf '{}\n' > "$DOCKER_CONFIG/config.json"