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

Commit

Permalink
Simplify Docker setup
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-bass committed Nov 28, 2023
1 parent 5c7d529 commit 0cbb886
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
/home/${USERNAME}/.ccache \
/home/${USERNAME}/.config \
/home/${USERNAME}/.ignition \
/home/${USERNAME}/.ros/log && \
/home/${USERNAME}/.colcon \
/home/${USERNAME}/.ros && \
chown -R $USER_UID:$USER_GID /home/${USERNAME} /opt/overlay_ws/

# Install additional dependencies
Expand All @@ -73,7 +74,6 @@ RUN rm -rf build/serial install/serial
FROM base as user-overlay

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

Expand All @@ -84,18 +84,19 @@ RUN --mount=type=cache,target=/home/${USERNAME}/.ccache \
. /opt/overlay_ws/install/setup.sh && \
colcon build

# Add the custom entrypoint
COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
RUN echo "source /entrypoint.sh && set +e" >> ~/.bashrc
# Set up the user's .bashrc file and shell.
RUN echo "source ${USER_WS}/install/setup.bash && 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

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

# Install any additional packages for development work
# hadolint ignore=DL3008
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
Expand All @@ -106,13 +107,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
gdb \
nano

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

# Add the dev entrypoint
COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
RUN echo "source /entrypoint.sh && set +e" >> ~/.bashrc
# 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"]

0 comments on commit 0cbb886

Please sign in to comment.