-
Notifications
You must be signed in to change notification settings - Fork 298
feat: add support to build with docker and natively #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e8e6d0b
b534e5d
feb5587
13b6e3e
dbcf262
eaec847
26bce82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,19 @@ | ||||||||||||||
| #!/bin/bash | ||||||||||||||
| # Clean Docker build artifacts and runtime cache | ||||||||||||||
|
|
||||||||||||||
| IMAGE_TAG="isaac-sim-docker:latest" | ||||||||||||||
| SCRIPT_DIR=$(dirname ${BASH_SOURCE}) | ||||||||||||||
| REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" | ||||||||||||||
|
|
||||||||||||||
| echo "Cleaning Docker artifacts..." | ||||||||||||||
|
|
||||||||||||||
| # _container_temp: build context (host ownership) | ||||||||||||||
| rm -rf "${REPO_ROOT}/_container_temp" | ||||||||||||||
|
|
||||||||||||||
| # _isaac_cache: runtime cache (uid 1234 ownership, use Docker to clean) | ||||||||||||||
| if [[ -d "${REPO_ROOT}/_isaac_cache" ]]; then | ||||||||||||||
| docker run --rm --entrypoint rm -v "${REPO_ROOT}/_isaac_cache":/cache "${IMAGE_TAG}" -rf /cache | ||||||||||||||
|
||||||||||||||
| docker run --rm --entrypoint rm -v "${REPO_ROOT}/_isaac_cache":/cache "${IMAGE_TAG}" -rf /cache | |
| if docker image inspect "${IMAGE_TAG}" >/dev/null 2>&1; then | |
| docker run --rm --entrypoint rm -v "${REPO_ROOT}/_isaac_cache":/cache "${IMAGE_TAG}" -rf /cache | |
| else | |
| echo "Warning: Docker image '${IMAGE_TAG}' not found. Skipping Docker-based cache cleanup." | |
| fi |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,10 @@ | |||||
| # Parse command line arguments | ||||||
| SKIP_DEDUPE=false | ||||||
| RUN_BUILD=false | ||||||
| DOCKER_BUILD=false | ||||||
| CONTAINER_PLATFORM=linux-x86_64 | ||||||
| BUILDER_IMAGE="isaac-sim-builder:latest" | ||||||
| PACKMAN_CACHE_DIR="$(pwd)/_packman_cache" | ||||||
|
|
||||||
| show_help() { | ||||||
| cat << EOF | ||||||
|
|
@@ -13,7 +16,8 @@ Usage: $0 [OPTIONS] | |||||
| Prepares Docker build by generating rsync script and copying necessary files. | ||||||
|
|
||||||
| OPTIONS: | ||||||
| --build Build Isaac Sim | ||||||
| --build Build Isaac Sim natively (requires GCC 11) | ||||||
| --docker-build Build Isaac Sim inside a container (recommended for Ubuntu 24.04+) | ||||||
| --x86_64 Build x86_64 container (default) | ||||||
| --aarch64 Build aarch64 container | ||||||
| --skip-dedupe Skip the deduplication process | ||||||
|
|
@@ -31,10 +35,40 @@ build_function() { | |||||
| return 1 | ||||||
| fi | ||||||
|
|
||||||
|
|
||||||
| echo "Build sequence completed successfully!" | ||||||
| } | ||||||
|
|
||||||
| docker_build_function() { | ||||||
| echo "Building Isaac Sim inside container..." | ||||||
|
|
||||||
| # Build the builder image from the Dockerfile (has GCC 11) | ||||||
| if ! docker build -t "$BUILDER_IMAGE" -f tools/docker/Dockerfile tools/docker/; then | ||||||
| echo "Error: Failed to build builder image" >&2 | ||||||
| return 1 | ||||||
| fi | ||||||
|
|
||||||
| # Create the packman cache directory | ||||||
| # This is mounted inside the container so symlinks created during build | ||||||
| # point to paths that exist on both host and container | ||||||
| mkdir -p "$PACKMAN_CACHE_DIR" | ||||||
|
|
||||||
| # Run build inside container with source mounted | ||||||
| # Mount packman cache to the SAME path used inside container so symlinks work on host | ||||||
| # Run with host user's UID/GID to ensure build artifacts have correct ownership | ||||||
| if ! docker run --rm --user "$(id -u):$(id -g)" --entrypoint bash \ | ||||||
| -e TERM=xterm-256color \ | ||||||
| -v "$(pwd):/workspace" \ | ||||||
| -v "$PACKMAN_CACHE_DIR:$PACKMAN_CACHE_DIR" \ | ||||||
| -e PM_PACKAGES_ROOT="$PACKMAN_CACHE_DIR" \ | ||||||
| -w /workspace "$BUILDER_IMAGE" \ | ||||||
| -c "touch .eula_accepted && ./build.sh -r"; then | ||||||
| echo "Error: Containerized build failed" >&2 | ||||||
| return 1 | ||||||
| fi | ||||||
|
|
||||||
| echo "Containerized build completed successfully!" | ||||||
| } | ||||||
|
|
||||||
| # Parse command line options | ||||||
| while [[ $# -gt 0 ]]; do | ||||||
| case $1 in | ||||||
|
|
@@ -46,6 +80,10 @@ while [[ $# -gt 0 ]]; do | |||||
| RUN_BUILD=true | ||||||
| shift | ||||||
| ;; | ||||||
| --docker-build) | ||||||
| DOCKER_BUILD=true | ||||||
| shift | ||||||
| ;; | ||||||
|
Comment on lines
+83
to
+86
|
||||||
| --x86_64) | ||||||
| CONTAINER_PLATFORM=linux-x86_64 | ||||||
| shift | ||||||
|
|
@@ -77,39 +115,72 @@ if [[ "$RUN_BUILD" == "true" ]]; then | |||||
| fi | ||||||
| fi | ||||||
|
|
||||||
| # Run containerized build if --docker-build was specified | ||||||
| if [[ "$DOCKER_BUILD" == "true" ]]; then | ||||||
| echo "" | ||||||
| docker_build_function | ||||||
| if [[ $? -ne 0 ]]; then | ||||||
| echo "Containerized build failed, exiting with error code 1" >&2 | ||||||
| exit 1 | ||||||
| fi | ||||||
| fi | ||||||
|
|
||||||
| # Check that _build/linux-x86_64 or _build/linux-aarch64 exists | ||||||
| if [[ ! -d "_build/${CONTAINER_PLATFORM}/release" ]]; then | ||||||
| echo "Error: _build/${CONTAINER_PLATFORM}/release does not exist" >&2 | ||||||
| echo "Please rerun the script with --build" >&2 | ||||||
| echo "Please rerun the script with --build or --docker-build" >&2 | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
|
|
||||||
| # Goes a bit faster if you have used PM_PATH_TO_SANDBOX="_" | ||||||
| if ! python3 -m pip install -r tools/docker/requirements.txt; then | ||||||
| echo "Failed to install Python requirements" >&2 | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
|
|
||||||
| if ! python3 tools/docker/generate_rsync_script.py --platform ${CONTAINER_PLATFORM} --target isaac-sim-docker --output-folder _container_temp; then | ||||||
| echo "Failed to generate rsync script" >&2 | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
|
|
||||||
| ./generated_rsync_package.sh | ||||||
|
|
||||||
| # Prep steps: generate rsync, copy files | ||||||
| # Use container if --docker-build was specified (no host dependencies) | ||||||
| # Otherwise use native Python (original behavior) | ||||||
| if [[ "$DOCKER_BUILD" == "true" ]]; then | ||||||
| PACKMAN_CACHE_DIR="$(pwd)/_packman_cache" | ||||||
|
||||||
| PACKMAN_CACHE_DIR="$(pwd)/_packman_cache" |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docker build command at line 142 uses the -q (quiet) flag and redirects output to /dev/null, which will suppress error messages if the build fails. This makes debugging difficult. Consider removing the -q flag or at least not redirecting stderr, so users can see what went wrong if the build fails.
| if ! docker build -q -t "$BUILDER_IMAGE" -f tools/docker/Dockerfile tools/docker/ >/dev/null; then | |
| if ! docker build -t "$BUILDER_IMAGE" -f tools/docker/Dockerfile tools/docker/; then |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --break-system-packages flag is used with pip install, which is generally discouraged as it can interfere with system-managed packages. Since this is running inside a container where the environment is controlled, consider using a virtual environment or user-level install (pip install --user) instead for better practice, even in containerized environments.
| pip install -q --break-system-packages -r tools/docker/requirements.txt && \ | |
| python3 -m pip install -q --user -r tools/docker/requirements.txt && \ |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,19 @@ | ||||||||||||||||
| #!/bin/bash | ||||||||||||||||
| PRIVACY_EMAIL="${PRIVACY_EMAIL:-user@example.com}" # Allow override via environment | ||||||||||||||||
|
|
||||||||||||||||
| IMAGE_TAG="isaac-sim-docker:latest" | ||||||||||||||||
| PRIVACY_EMAIL="user@example.com" | ||||||||||||||||
|
||||||||||||||||
| PRIVACY_EMAIL="user@example.com" | |
| PRIVACY_EMAIL="${PRIVACY_EMAIL:-user@example.com}" |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The xhost +local:docker call unconditionally relaxes X11 access control for your current display, effectively allowing any local client mapped to the docker user (i.e., any rootless Docker container) to connect to and control your X session. A compromised or malicious container image could then capture keystrokes, scrape window contents, or inject input into host applications. Consider narrowing X11 permissions to only the specific user/container needed and restoring the original xhost configuration after the container exits instead of leaving this broad rule in place.
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script creates a cache directory and attempts to change its ownership using a Docker container before the image is guaranteed to exist. If the user runs this script before building the image (isaac-sim-docker:latest), the chown command will fail with "image not found". Consider checking if the image exists first, or handle the error gracefully, or document that this script should only be run after building the image.
| mkdir -p "${CACHE_DIR}" | |
| mkdir -p "${CACHE_DIR}" | |
| if ! docker image inspect "${IMAGE_TAG}" > /dev/null 2>&1; then | |
| echo "Error: Docker image '${IMAGE_TAG}' not found. Please build or pull it before running this script." >&2 | |
| exit 1 | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable SCRIPT_DIR uses
dirname ${BASH_SOURCE}without proper quoting. This should be"${BASH_SOURCE[0]}"with quotes and array index to handle paths with spaces correctly and to follow bash best practices.