Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions .github/workflows/docker-arm64v8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ jobs:
permissions:
contents: read
packages: write

steps:
- name: Configure non-interactive Docker credentials
run: |
docker_config="$RUNNER_TEMP/docker-config"
mkdir -p "$docker_config"
printf '{}\n' > "$docker_config/config.json"
echo "DOCKER_CONFIG=$docker_config" >> "$GITHUB_ENV"

- name: Checkout repository
uses: actions/checkout@v4

Expand All @@ -53,12 +59,27 @@ jobs:
# ARM64 build and works with Docker Desktop's containerd image store.
driver: docker

- name: Log in to Docker Hub
- name: Configure Docker Hub authentication
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
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
Expand All @@ -80,3 +101,7 @@ jobs:
platforms: linux/arm64/v8
build-args: |
ROS_DISTRO=${{ env.ROS_DISTRO }}

- name: Clear Docker Hub credentials
if: always() && github.event_name != 'pull_request'
run: printf '{}\n' > "$DOCKER_CONFIG/config.json"
Loading