Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
807a4ed
Remove redundant test result copying steps from CI workflow (implemen…
myurasov-nv Mar 7, 2026
82350f6
Formatting
myurasov-nv Mar 7, 2026
24e9526
Sync cuRobo abd Base dockerfiles
myurasov-nv Mar 7, 2026
628c78e
Typos
myurasov-nv Mar 7, 2026
5e96dee
FIx file copying
myurasov-nv Mar 7, 2026
6801fb7
Remove hardcoded image tag
myurasov-nv Mar 7, 2026
7ffefdc
Temporarily disable tasks, add toy task to debug ECR
myurasov-nv Mar 8, 2026
2ddadc5
ECR Build-Push-Pull action (drop-in repl for docker-build)
myurasov-nv Mar 8, 2026
356133e
Un-disable disabled workflows, disable toy one
myurasov-nv Mar 8, 2026
579243d
Replace build jobs with ECR-backed ones; optimize task graph for maxi…
myurasov-nv Mar 8, 2026
31e8912
Some docs for the action
myurasov-nv Mar 8, 2026
035b08c
Make curobo build independet of base build
myurasov-nv Mar 8, 2026
d6ca913
More info mesages
myurasov-nv Mar 8, 2026
fc2a6c2
--format
myurasov-nv Mar 8, 2026
1b4c0e0
Remove debugging ECR workflow
myurasov-nv Mar 8, 2026
577c29b
Cleanup
myurasov-nv Mar 8, 2026
8f14e6e
Typo
myurasov-nv Mar 8, 2026
06769ff
Remove aws-region warning message from ECR action
myurasov-nv Mar 8, 2026
b66881c
Switch to Docker Buildx
myurasov-nv Mar 8, 2026
dcd0441
Separate layer cache images for base/curobo
myurasov-nv Mar 8, 2026
de80701
Add --platform, x86/adm64 fo now - for compatibility
myurasov-nv Mar 8, 2026
799070f
Use unique builder names to avoid race conditions
myurasov-nv Mar 8, 2026
e6e909d
Reuse existing builder on workflow re-runs
myurasov-nv Mar 8, 2026
8572535
Add cache tags for testing tasks
myurasov-nv Mar 8, 2026
2b4cfa1
Add nvcr.io login step just in case
myurasov-nv Mar 8, 2026
3da458a
Add comments for ECR image cleanup steps( for greptile!)
myurasov-nv Mar 8, 2026
7f47022
Improve ECR image pull error handling and logging
myurasov-nv Mar 8, 2026
5dc0277
Cleanup dependencies on the same like so image is slightly smaller
myurasov-nv Mar 8, 2026
e09aff9
Add cleanup for temporary Docker config directory on exit
myurasov-nv Mar 8, 2026
06ad4ee
Use public IsacSim image in example
myurasov-nv Mar 9, 2026
c59b1b5
Copy rest of the files in a mo robust way
myurasov-nv Mar 9, 2026
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
4 changes: 2 additions & 2 deletions .github/actions/docker-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ runs:

# Build Docker image
docker buildx build --progress=plain --platform linux/amd64 \
-t isaac-lab-dev \
-t $image_tag \
--build-arg ISAACSIM_BASE_IMAGE_ARG="$isaacsim_base_image" \
--build-arg ISAACSIM_VERSION_ARG="$isaacsim_version" \
Expand All @@ -77,7 +76,8 @@ runs:
--load $context_path

echo "✅ Docker image built successfully: $image_tag"
docker images | grep isaac-lab-dev
echo "Current local Docker images:"
docker images
Comment thread
myurasov-nv marked this conversation as resolved.
Resolved
}

# Call the function with provided parameters
Expand Down
42 changes: 42 additions & 0 deletions .github/actions/ecr-build-push-pull/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ecr-build-push-pull

Action that ether builds Docker image and pushes it to ECR or pulls it from there.

ECR is also used as the BuildKit layer cache, so even first builds benefit from cached layers.

Drop-in replacement for `docker-build/action.yml` with ECR-backed caching.

## Prerequisites

The runner must be authenticated to AWS; the action calls
`aws sts get-caller-identity` and `aws ecr get-login-password` using whatever credentials
are available in the environment.

The IAM role must have at minimum:
- `ecr:GetAuthorizationToken` (on `*`)
- `ecr:BatchCheckLayerAvailability`, `ecr:GetDownloadUrlForLayer`, `ecr:BatchGetImage` (pull)
- `ecr:InitiateLayerUpload`, `ecr:UploadLayerPart`, `ecr:CompleteLayerUpload`, `ecr:PutImage` (push)

## Inputs

| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `image-tag` | yes | — | Local Docker tag (e.g. `isaac-lab-dev:pr-1-abc`) |
| `isaacsim-base-image` | yes | — | IsaacSim base image (`ISAACSIM_BASE_IMAGE_ARG` build-arg) |
| `isaacsim-version` | yes | — | IsaacSim version (`ISAACSIM_VERSION_ARG` build-arg) |
| `dockerfile-path` | no | `docker/Dockerfile.base` | Path to Dockerfile |
| `ecr-repository` | no | `""` | ECR repo name. If omitted, ECR push/pull/cache is skipped. |
| `aws-region` | no | `us-west-2` | ECR region. Should match the runner's EC2 region for best performance. |

## Usage

```yaml
- uses: ./.github/actions/ecr-build-push-pull
with:
image-tag: ${{ env.DOCKER_IMAGE_TAG }}
isaacsim-base-image: nvcr.io/nvidia/isaac-sim
isaacsim-version: 6.0.0
dockerfile-path: docker/Dockerfile.base
ecr-repository: isaaclab-ci
aws-region: us-west-2
```
151 changes: 151 additions & 0 deletions .github/actions/ecr-build-push-pull/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause

name: 'ECR Build-Push-Pull'
description: >
Builds a Docker image and pushes it to ECR, using ECR as the layer cache.
If the image already exists in ECR (same tag), pulls it instead of building.
Drop-in replacement for docker-build/action.yml with ECR-backed caching.

inputs:
image-tag:
description: 'Tag for the Docker image (e.g. my-image:latest).'
required: true
isaacsim-base-image:
description: 'IsaacSim base image (passed as ISAACSIM_BASE_IMAGE_ARG build-arg).'
required: true
isaacsim-version:
description: 'IsaacSim version (passed as ISAACSIM_VERSION_ARG build-arg).'
required: true
dockerfile-path:
description: 'Path to Dockerfile, relative to the repository root'
default: 'docker/Dockerfile.base'
required: false
ecr-repository:
description: 'ECR repository name. If omitted, ECR push/pull/cache is skipped and the image is always built.'
required: false
default: ''
cache-tag:
description: >
Tag used for the ECR layer cache image (e.g. "cache-base", "cache-curobo").
required: false
default: 'cache'
aws-region:
description: >
AWS region (e.g. us-west-2, etc).
For best performance, should match the runner EC2 region.
required: false
default: 'us-west-2'

runs:
using: composite
steps:
- name: ECR Build, Push, Pull
shell: bash
run: |
IMAGE_TAG="${{ inputs.image-tag }}"
ECR_REPOSITORY="${{ inputs.ecr-repository }}"
AWS_REGION="${{ inputs.aws-region }}"

if [ -z "${ECR_REPOSITORY}" ]; then
echo "🟠 ecr-repository not set, skipping ECR login/push/pull. Building locally only."
else
# Get AWS account ID from the runner's IAM instance profile
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
REGISTRY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com"

# Derive ECR image tag by slugifying the local image-tag
# (colons/slashes not valid in ECR tags)
ECR_TAG=$(echo "${IMAGE_TAG}" | tr ':/' '--')
ECR_IMAGE="${REGISTRY}/${ECR_REPOSITORY}:${ECR_TAG}"
CACHE_IMAGE="${REGISTRY}/${ECR_REPOSITORY}:${{ inputs.cache-tag }}"

# The runner's credential store is broken ("not implemented"), so use a temp config dir
# with credsStore disabled. Copy existing ~/.docker/config.json first to preserve other
# registry auths (e.g. nvcr.io), then strip credsStore/credHelpers.
#
DOCKER_CONFIG_DIR=$(mktemp -d)
trap 'rm -rf "${DOCKER_CONFIG_DIR}"' EXIT
if [ -f "${HOME}/.docker/config.json" ]; then
python3 -c "import json; cfg=json.load(open('${HOME}/.docker/config.json')); cfg['credsStore']=''; cfg.pop('credHelpers',None); json.dump(cfg,open('${DOCKER_CONFIG_DIR}/config.json','w'))"
else
echo '{"credsStore":""}' > "${DOCKER_CONFIG_DIR}/config.json"
fi
#
# Export so all subsequent docker calls in this job inherit it
echo "DOCKER_CONFIG=${DOCKER_CONFIG_DIR}" >> "$GITHUB_ENV"
export DOCKER_CONFIG="${DOCKER_CONFIG_DIR}"
Comment thread
myurasov-nv marked this conversation as resolved.
Resolved

# Login to ECR registry with token provided by aws cli
echo "🟢 Logging into ECR registry..."
aws ecr get-login-password --region "${AWS_REGION}" | \
docker login --username AWS --password-stdin "${REGISTRY}"

# Try pulling the exact image from ECR to skip the build
echo "🟢 Checking for existing image ${ECR_IMAGE} in ECR..."
PULL_OUTPUT=$(docker pull "${ECR_IMAGE}" 2>&1) && {
echo "🟢 Image found in ECR, pulled: ${ECR_IMAGE}"
docker tag "${ECR_IMAGE}" "${IMAGE_TAG}"
echo "🟢 Tagged as: ${IMAGE_TAG} — skipping build."
exit 0
} || {
echo "🟠 Image not pulled (will build instead): ${PULL_OUTPUT}"
}
fi

# Log into nvcr.io so the Dockerfile can pull nvcr.io base images.
# Credential is written into the temp config dir when ECR is enabled,
# and into the default config when it is not.
if [ -n "${{ env.NGC_API_KEY }}" ]; then
echo "🟢 Logging into nvcr.io..."
docker login -u \$oauthtoken -p ${{ env.NGC_API_KEY }} nvcr.io
else
echo "🟠 NGC_API_KEY not set — skipping nvcr.io login (normal for fork PRs)"
fi
Comment thread
myurasov-nv marked this conversation as resolved.
Resolved

# Build the image

BUILD_ARGS=(
--progress=plain
--platform linux/amd64
-f "${{ inputs.dockerfile-path }}"
--build-arg "ISAACSIM_BASE_IMAGE_ARG=${{ inputs.isaacsim-base-image }}"
--build-arg "ISAACSIM_VERSION_ARG=${{ inputs.isaacsim-version }}"
--build-arg "ISAACSIM_ROOT_PATH_ARG=/isaac-sim"
--build-arg "ISAACLAB_PATH_ARG=/workspace/isaaclab"
--build-arg "DOCKER_USER_HOME_ARG=/root"
-t "${IMAGE_TAG}"
)

# Add ECR layer caching
if [ -n "${ECR_REPOSITORY}" ]; then
BUILD_ARGS+=(
--cache-from "type=registry,ref=${CACHE_IMAGE}"
--cache-to "type=registry,ref=${CACHE_IMAGE},mode=max"
-t "${ECR_IMAGE}"
)
fi

# Set up buildx builder with docker-container driver (required for registry cache export).
BUILDER_NAME="ci-builder-${{ github.run_id }}-${{ github.job }}"

# Create builder (or fall back to reusing existing one on workflow re-runs)
docker buildx create --use --driver docker-container --name "${BUILDER_NAME}" \
|| docker buildx use "${BUILDER_NAME}"

echo "🟢 Building ${IMAGE_TAG}..."
docker buildx build --load "${BUILD_ARGS[@]}" .
Comment thread
myurasov-nv marked this conversation as resolved.
Resolved

# Clean up builder
docker buildx rm "${BUILDER_NAME}" || true

echo "🟢 Build completed for ${IMAGE_TAG}, pushing to ECR..."

if [ -n "${ECR_REPOSITORY}" ]; then
docker push "${ECR_IMAGE}"
echo "🟢 Pushed ${ECR_IMAGE} to ECR"
fi

echo "🟢 Image ${IMAGE_TAG} is ready!"
Loading
Loading