File size: 4,555 Bytes
a0ea4e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# 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

# Container for Isaac Lab installation CI tests.
#
# Ships both uv and conda so a single image can run every installation
# scenario.  Image is large but build is cached across runs.
#
# Usage:
#   docker build --build-arg BASE_IMAGE=ubuntu:24.04 -t isaaclab-installci .
#   docker run --rm isaaclab-installci -v -k "test_pip"

ARG BASE_IMAGE=ubuntu:24.04
FROM ${BASE_IMAGE}

# isaaclab.x debug mode
ENV DEBUG=1

SHELL ["/bin/bash", "-c"]

LABEL description="Container for installation CI tests."

ENV LANG=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Install system dependencies needed for building Py packages
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    git \
    curl \
    cmake \
    python3 \
    python3-dev \
    python3-pip \
    libglib2.0-0 \
    python3-venv \
    build-essential \
    sudo \
    && rm -rf /var/lib/apt/lists/*

# ARM-specific GL/X11 dev headers are intentionally NOT pre-installed here.
# ``./isaaclab.sh -i`` auto-installs them via apt when missing, so install_ci
# exercises the real user-visible install path on ARM.

# Make python3 the default python
RUN ln -sf /usr/bin/python3 /usr/bin/python

# Install test runner dependencies into the system Python
RUN pip install --break-system-packages \
    pytest>=8.0 \
    pytest-timeout>=2.0

# Install uv system-wide so non-root users can invoke it without PATH trickery
RUN curl -LsSf https://astral.sh/uv/install.sh | UV_INSTALL_DIR=/usr/local/bin sh

# Install Miniconda into the isaaclab user's home directory so the runtime user
# has full write access for creating environments and caching packages.
ARG MINICONDA_VERSION=latest
RUN ARCH=$(case "$(uname -m)" in \
      aarch64|arm64) echo "aarch64" ;; \
      *) echo "x86_64" ;; \
    esac) \
    && curl -fsSL "https://repo.anaconda.com/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-${ARCH}.sh" \
      -o /tmp/miniconda.sh \
    && bash /tmp/miniconda.sh -b -p /home/isaaclab/miniconda3 \
    && rm /tmp/miniconda.sh \
    && chown -R 1000:1000 /home/isaaclab/miniconda3

# Add the conda wrapper (condabin/) to PATH but NOT miniconda3/bin/, so the
# system Python remains the default `python` and only `conda` itself becomes
# globally available.  Tests that need conda's Python activate envs explicitly
# via `conda run -n <env>`.
ENV PATH="/home/isaaclab/miniconda3/condabin:${PATH}"

# Copy the repo
ARG ISAACLAB_PATH=/workspace/isaaclab
ENV ISAACLAB_PATH=${ISAACLAB_PATH}
COPY . ${ISAACLAB_PATH}

# Fix line endings in .sh files (Win git may add \r)
RUN find ${ISAACLAB_PATH} -type f -name "*.sh" -exec sed -i 's/\r$//' {} +
RUN chmod +x ${ISAACLAB_PATH}/isaaclab.sh

# Create non-root runtime user and transfer workspace ownership.
# uid/gid 1000 match the GitHub runner bind-mounts used by Docker-based tests.
# The default ``ubuntu`` user (uid 1000) on Ubuntu 24.04 base images is
# removed first so uid 1000 unambiguously resolves to ``isaaclab`` and our
# NOPASSWD sudoers entry applies.
RUN if getent passwd ubuntu >/dev/null; then userdel -r ubuntu; fi \
 && if getent group ubuntu >/dev/null; then groupdel ubuntu; fi \
 && groupadd --gid 1000 isaaclab \
 && useradd --uid 1000 --gid 1000 -m -s /bin/bash isaaclab \
 && chown isaaclab:isaaclab /home/isaaclab \
 && mkdir -p /home/isaaclab/.cache/uv /home/isaaclab/.cache/pip \
 && chown -R isaaclab:isaaclab /home/isaaclab/.cache \
 && chown -R isaaclab:isaaclab ${ISAACLAB_PATH}

# Passwordless sudo for the runtime user so ``./isaaclab.sh -i`` can apt-get
# install missing GL/X11 build deps without prompting at test time.
RUN echo "isaaclab ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/isaaclab \
 && chmod 0440 /etc/sudoers.d/isaaclab

USER isaaclab

# Accept Miniconda default-channel Terms of Service non-interactively so that
# `conda create` works without user prompts inside the container.
# Runs as isaaclab so the acceptance is written to /home/isaaclab/.condarc.
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
    conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r

WORKDIR ${ISAACLAB_PATH}

# Run all installation CI tests by default
ENTRYPOINT ["python", "-m", "pytest", "-c", "source/isaaclab/test/install_ci/pytest.ini", "source/isaaclab/test/install_ci"]
CMD ["-v", "--tb=short"]