Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
Fixes to overlay Docker for new workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-bass committed Jan 31, 2024
1 parent 56165c6 commit 844ac2d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 32 deletions.
43 changes: 21 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ARG USER_UID
ARG USER_GID

# Copy source code from the workspace's ROS 2 packages to a workspace inside the container
ARG USER_WS=/home/${USERNAME}/user_overlay_ws
ARG USER_WS=/home/${USERNAME}/user_ws
ENV USER_WS=${USER_WS}
RUN mkdir -p ${USER_WS}/src ${USER_WS}/build ${USER_WS}/install ${USER_WS}/log
COPY ./src ${USER_WS}/src
Expand Down Expand Up @@ -66,33 +66,14 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
WORKDIR /opt/overlay_ws
RUN rm -rf build/serial install/serial

#########################################
# Target for compiled, deployable image #
#########################################
FROM base as user-overlay

ARG USERNAME
ARG USER_WS=/home/${USERNAME}/user_overlay_ws
ENV USER_WS=${USER_WS}

# Compile the workspace
WORKDIR $USER_WS
# hadolint ignore=SC1091
RUN --mount=type=cache,target=/home/${USERNAME}/.ccache \
. /opt/overlay_ws/install/setup.sh && \
colcon build

# Set up the user's .bashrc file and shell.
# RUN echo "source /moveit_studio_utils/setup_workspaces.sh && set +e" >> /home/${USERNAME}/.bashrc
CMD ["/usr/bin/bash"]

###################################################################
# Target for the developer build which does not compile any code. #
###################################################################
FROM base as user-overlay-dev

ARG USERNAME
ARG USER_WS=/home/${USERNAME}/user_overlay_ws
ARG USER_WS=/home/${USERNAME}/user_ws
ENV USER_WS=${USER_WS}

# Install any additional packages for development work
Expand All @@ -106,5 +87,23 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
nano

# Set up the user's .bashrc file and shell.
# RUN echo "source /moveit_studio_utils/setup_workspaces.sh && set +e" >> /home/${USERNAME}/.bashrc
CMD ["/usr/bin/bash"]

#########################################
# Target for compiled, deployable image #
#########################################
FROM base as user-overlay

ARG USERNAME
ARG USER_WS=/home/${USERNAME}/user_ws
ENV USER_WS=${USER_WS}

# Compile the workspace
WORKDIR $USER_WS
# hadolint ignore=SC1091
RUN --mount=type=cache,target=/home/${USERNAME}/.ccache \
. /opt/overlay_ws/install/setup.sh && \
colcon build

# Set up the user's .bashrc file and shell.
CMD ["/usr/bin/bash"]
17 changes: 7 additions & 10 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ services:
args:
- USER_UID=${STUDIO_USER_UID:-1000}
- USER_GID=${STUDIO_USER_UID:-1000}
- USERNAME=${USERNAME:-studio-user}
- USERNAME=${STUDIO_USERNAME:-studio-user}
- MOVEIT_STUDIO_BASE_IMAGE=picknikciuser/moveit-studio:${STUDIO_DOCKER_TAG:-main}
# Set the user workspace folder location.
environment:
- USER_WS=/home/${USERNAME:-studio-user}/user_overlay_ws

# Starts the MoveIt Pro Agent and the Bridge between the Agent and the Web UI
agent_bridge:
Expand Down Expand Up @@ -99,12 +96,12 @@ services:
privileged: true
volumes:
# Mount the source code, colcon generated artifacts, and ccache
- ./src/:/home/${USERNAME:-studio-user}/user_overlay_ws/src:rw
- ./build/:/home/${USERNAME:-studio-user}/user_overlay_ws/build:rw
- ./install/:/home/${USERNAME:-studio-user}/user_overlay_ws/install:rw
- ./log/:/home/${USERNAME:-studio-user}/user_overlay_ws/log:rw
- ./.ccache/:/home/${USERNAME:-studio-user}/.ccache:rw
- ${HOME}/.ros/log_moveit_pro:/home/${USERNAME:-studio-user}/.ros/log
- ./src/:/home/${STUDIO_USERNAME:-studio-user}/user_overlay_ws/src:rw
- ./build/:/home/${STUDIO_USERNAME:-studio-user}/user_overlay_ws/build:rw
- ./install/:/home/${STUDIO_USERNAME:-studio-user}/user_overlay_ws/install:rw
- ./log/:/home/${STUDIO_USERNAME:-studio-user}/user_overlay_ws/log:rw
- ./.ccache/:/home/${STUDIO_USERNAME:-studio-user}/.ccache:rw
- ${HOME}/.ros/log_moveit_pro:/home/${STUDIO_USERNAME:-studio-user}/.ros/log
# Allow access to host hardware e.g. RealSense cameras
- /dev:/dev
command: sleep infinity
Expand Down

0 comments on commit 844ac2d

Please sign in to comment.