Skip to content

Commit

Permalink
Integrated prebuild.sh on container creation. colcon build works from…
Browse files Browse the repository at this point in the history
… new containers
  • Loading branch information
EmilianoHFlores committed Feb 14, 2025
1 parent 141d864 commit 7f7ced8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
9 changes: 7 additions & 2 deletions docker/manipulation/Dockerfile.cuda
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ RUN mkdir -p /workspace/requirements
# Torch+GPU
RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

# ROS Requirements
RUN apt update && apt install -y ros-humble-cv-bridge ros-humble-rviz2 ros-humble-moveit
# ROS Requirements, will need several tools from desktop TODO: change desktop for specific dependencies
RUN apt update && apt install -y ros-humble-desktop ros-humble-cv-bridge ros-humble-moveit

# Python Requirements
COPY manipulation/requirements.txt /workspace/requirements/requirements.txt
Expand All @@ -23,4 +23,9 @@ RUN pip3 install -r /workspace/requirements/requirements.txt
RUN mkdir -p /workspace/src/home2
RUN chown -R ros:ros /workspace

# prebuild and more
RUN git clone https://github.com/RoBorregos/home2 --recursive /workspace/src/home2
RUN rosdep init && rosdep update && rosdep install --from-paths /workspace/src/home2 --ignore-src -r -y
RUN rosdep fix-permissions

ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
11 changes: 11 additions & 0 deletions docker/manipulation/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ case $ENV_TYPE in
check_image_exists "$CPU_IMAGE" || [ $rebuild -eq 1 ]
if [ $? -eq 1 ]; then
docker compose -f ../cpu.yaml build --build-arg "USER_UID=$(id -u)" --build-arg "USER_GID=$(id -g)"
rebuild=1
fi
;;
"cuda")
Expand All @@ -82,6 +83,7 @@ case $ENV_TYPE in
check_image_exists "$CUDA_IMAGE" || [ $rebuild -eq 1 ]
if [ $? -eq 1 ]; then
docker compose -f ../cuda.yaml build --build-arg "USER_UID=$(id -u)" --build-arg "USER_GID=$(id -g)"
rebuild=1
fi

;;
Expand Down Expand Up @@ -117,6 +119,15 @@ fi
RUNNING_CONTAINER=$(docker ps -q -f "name=$CONTAINER_NAME")

xhost +

# if rebuild, run ./prebuild.sh
if [ $rebuild -eq 1 ]; then
# Rebuild modifies lines on mounted files, so this is done after the container is started
# TODO: Is there a better way to do this?
echo "Running prebuild script..."
docker exec -it $CONTAINER_NAME /bin/bash -c "./src/home2/prebuild.sh"
fi

if [ -n "$RUNNING_CONTAINER" ]; then
echo "Container $CONTAINER_NAME is already running. Executing bash..."
docker exec -it $CONTAINER_NAME /bin/bash
Expand Down
2 changes: 1 addition & 1 deletion manipulation/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HRI
# Manipulation

Tree structure

Expand Down
2 changes: 1 addition & 1 deletion prebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ rosdep install --from-paths . --ignore-src --skip-keys gpd
GPD_DIR=$SCRIPT_DIR/manipulation/packages/gpd

if [ ! -d "$GPD_DIR" ]; then
echo "Error: gdp does not exist"
echo "Error: GPD does not exist"
git submodule update --init --recursive

fi
Expand Down

0 comments on commit 7f7ced8

Please sign in to comment.