Skip to content
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

Allow building docs in Docker containers #308

Merged
merged 2 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Files and folders that don't need to be in the Docker build context.
docker-compose.yaml
dependencies/
docker/Dockerfile
docs/
test/results/

# Metadata that doesn't need to be in the Docker build context.
Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,22 @@ services:
- QT_X11_NO_MITSHM=1
- NVIDIA_DRIVER_CAPABILITIES=all
volumes:
# Mount the source code and testing utilities.
# Mount the source code.
- ./pyrobosim/:/pyrobosim_ws/src/pyrobosim/:rw
- ./pyrobosim_msgs/:/pyrobosim_ws/src/pyrobosim_msgs/:rw
- ./pyrobosim_ros/:/pyrobosim_ws/src/pyrobosim_ros/:rw
# Mount docs and testing utilities.
- ./docs/:/pyrobosim_ws/src/docs/:rw
- ./test/:/pyrobosim_ws/src/test/:rw
- ./pytest.ini:/pyrobosim_ws/pytest.ini:rw
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
command: sleep infinity

docs:
extends: base
command: src/docs/generate_docs.bash
test:
extends: base
command: src/test/run_tests.bash ${ROS_DISTRO:-humble}
Expand Down
24 changes: 14 additions & 10 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ WORKDIR /opt/pyrobosim/
COPY setup/configure_pddlstream.bash setup/
RUN setup/configure_pddlstream.bash

# Install pip dependencies for testing
# Install pip dependencies for docs and testing
ENV PIP_BREAK_SYSTEM_PACKAGES=1
COPY docs/python_docs_requirements.txt docs/
COPY test/python_test_requirements.txt test/
RUN pip3 install -r test/python_test_requirements.txt
RUN pip3 install -r docs/python_docs_requirements.txt && \
pip3 install -r test/python_test_requirements.txt

# Copy the rest of the source directory and install pyrobosim
COPY . /opt/pyrobosim/
Expand All @@ -61,23 +63,25 @@ RUN apt-get install -y \
libegl1 libgl1-mesa-dev libglu1-mesa-dev '^libxcb.*-dev' libx11-xcb-dev \
libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libxrender-dev

# Create a colcon workspace
# Create a ROS 2 workspace
RUN mkdir -p /pyrobosim_ws/src/pyrobosim
WORKDIR /pyrobosim_ws/src

# Install dependencies
COPY setup/configure_pddlstream.bash /pyrobosim_ws/src/setup/
WORKDIR /pyrobosim_ws/src/setup
RUN ./configure_pddlstream.bash

COPY . /pyrobosim_ws/src/
RUN setup/configure_pddlstream.bash

# Install pyrobosim and testing dependencies
# Install pyrobosim, docs, and testing dependencies
ENV PIP_BREAK_SYSTEM_PACKAGES=1
WORKDIR /pyrobosim_ws/src
COPY pyrobosim/setup.py pyrobosim/
COPY docs/python_docs_requirements.txt docs/
COPY test/python_test_requirements.txt test/
RUN pip3 install -e ./pyrobosim && \
pip3 install -r docs/python_docs_requirements.txt && \
pip3 install -r test/python_test_requirements.txt

# Build the ROS workspace
# Build the ROS workspace, which includes pyrobosim
COPY . /pyrobosim_ws/src/
WORKDIR /pyrobosim_ws
RUN . /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build
Expand Down
Loading