Skip to content

Commit

Permalink
Docker updates
Browse files Browse the repository at this point in the history
  • Loading branch information
snelsondurrant committed Oct 18, 2024
1 parent 8ecd96b commit 1d36f18
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
54 changes: 27 additions & 27 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ RUN echo "deb [signed-by=/etc/apt/keyrings/koromix-archive-keyring.gpg] https://
RUN apt update && apt install -y tytools

# Set up a new user
RUN useradd -ms /bin/bash $UNAME
RUN usermod -aG sudo $UNAME
RUN usermod -aG dialout $UNAME
RUN echo "$UNAME:$UNAME" | chpasswd
USER $UNAME
WORKDIR /home/$UNAME
RUN useradd -ms /bin/bash ${UNAME}
RUN usermod -aG sudo ${UNAME}
RUN usermod -aG dialout ${UNAME}
RUN echo "${UNAME}:${UNAME}" | chpasswd
USER ${UNAME}
WORKDIR /home/${UNAME}

# Build and install gtsam (from source)
USER root
RUN apt update && apt install -y \
libboost-all-dev \
python3-pip
USER $UNAME
USER ${UNAME}

RUN git clone --depth 1 --branch 4.2 https://github.com/borglab/gtsam.git
RUN mkdir /home/$UNAME/gtsam/build
RUN mkdir /home/${UNAME}/gtsam/build

WORKDIR /home/$UNAME/gtsam/build
WORKDIR /home/${UNAME}/gtsam/build
RUN cmake .. -DGTSAM_BUILD_PYTHON=ON -DGTSAM_PYTHON_VERSION=3.10.12
RUN make python-install
WORKDIR /home/$UNAME
WORKDIR /home/${UNAME}

RUN rm -r gtsam

Expand All @@ -56,14 +56,14 @@ RUN unzip Eigen.zip
USER root
RUN cp -r eigen-3.4.0/Eigen /usr/local/include
RUN rm -r eigen-3.4.0
USER $UNAME
USER ${UNAME}

RUN rm Eigen.zip

# Install PlatformIO
USER root
RUN apt install -y python3-venv
USER $UNAME
USER ${UNAME}

RUN curl -fsSL -o get-platformio.py https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py
RUN python3 get-platformio.py
Expand All @@ -73,32 +73,32 @@ RUN rm get-platformio.py
RUN mkdir -p /usr/local/bin

USER root
RUN ln -s /home/$UNAME/.platformio/penv/bin/platformio /usr/local/bin/platformio
RUN ln -s /home/$UNAME/.platformio/penv/bin/pio /usr/local/bin/pio
RUN ln -s /home/$UNAME/.platformio/penv/bin/piodebuggdb /usr/local/bin/piodebuggdb
USER $UNAME
RUN ln -s /home/${UNAME}/.platformio/penv/bin/platformio /usr/local/bin/platformio
RUN ln -s /home/${UNAME}/.platformio/penv/bin/pio /usr/local/bin/pio
RUN ln -s /home/${UNAME}/.platformio/penv/bin/piodebuggdb /usr/local/bin/piodebuggdb
USER ${UNAME}

# Set up ROS sourcing
RUN echo "source /opt/ros/humble/setup.bash" >> /home/$UNAME/.bashrc
RUN echo "source /opt/ros/humble/setup.bash" >> /home/${UNAME}/.bashrc

# Install the micro-ROS agent
RUN mkdir microros_ws

WORKDIR /home/$UNAME/microros_ws
WORKDIR /home/${UNAME}/microros_ws
RUN git clone -b humble https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup
RUN rosdep update

USER root
RUN rosdep install --from-paths src --ignore-src -y
USER $UNAME
USER ${UNAME}

SHELL ["/bin/bash", "-c"]
RUN source /opt/ros/humble/setup.bash && colcon build
RUN source /opt/ros/humble/setup.bash && source install/setup.bash && ros2 run micro_ros_setup create_agent_ws.sh
RUN source /opt/ros/humble/setup.bash && source install/setup.bash && ros2 run micro_ros_setup build_agent.sh
SHELL ["/bin/sh", "-c"]

WORKDIR /home/$UNAME
WORKDIR /home/${UNAME}

# Install MOOS-IvP
USER root
Expand All @@ -107,14 +107,14 @@ RUN apt install -y cmake \
subversion \
libfltk1.3-dev \
libtiff5-dev
USER $UNAME
USER ${UNAME}

RUN svn co https://oceanai.mit.edu/svn/moos-ivp-aro/trunk moos-ivp

WORKDIR /home/$UNAME/moos-ivp
WORKDIR /home/${UNAME}/moos-ivp
RUN ./build-moos.sh
RUN ./build-ivp.sh
WORKDIR /home/$UNAME
WORKDIR /home/${UNAME}


# Install development dependencies (rqt, plotjuggler, documentation, etc.)
Expand All @@ -136,7 +136,7 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*; \
fi
USER $UNAME
USER ${UNAME}

# Install development Python dependencies
RUN if [ "$TARGETARCH" = "amd64" ]; then \
Expand All @@ -155,16 +155,16 @@ RUN apt update && apt install -y \
ros-humble-rosbag2-storage-mcap \
netcat-openbsd \
rsync
USER $UNAME
USER ${UNAME}

# Install Python dependencies
RUN pip3 install numpy==1.26.0 \
scipy \
matplotlib \
pyproj
RUN echo "export PATH=$PATH:/home/$UNAME/.local/bin:/home/$UNAME/moos-ivp/bin" >> /home/$UNAME/.bashrc
RUN echo "export PATH=$PATH:/home/${UNAME}/.local/bin:/home/${UNAME}/moos-ivp/bin" >> /home/${UNAME}/.bashrc

# Update and upgrade
USER root
RUN apt update && apt upgrade -y
USER $UNAME
USER ${UNAME}
12 changes: 6 additions & 6 deletions docker/docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ services:
image: frostlab/cougars:latest
platform: linux/amd64
container_name: cougars
user: $UNAME
user: ${UNAME}
network_mode: host
environment:
DISPLAY: $DISPLAY # Required for GUI applications
MPLBACKEND: Qt5Agg # Required for GUI applications
privileged: true
volumes:
- ../bag:/home/$UNAME/bag:rw
- ../config:/home/$UNAME/config:rw
- ../cougars-ros2:/home/$UNAME/ros2_ws
- ../cougars-teensy:/home/$UNAME/teensy_ws
- ../cougars-gpio:/home/$UNAME/gpio
- ../bag:/home/${UNAME}/bag:rw
- ../config:/home/${UNAME}/config:rw
- ../cougars-ros2:/home/${UNAME}/ros2_ws
- ../cougars-teensy:/home/${UNAME}/teensy_ws
- ../cougars-gpio:/home/${UNAME}/gpio
- /etc/localtime:/etc/localtime:ro # Syncs the container's time with the host
- /tmp/.X11-unix:/tmp/.X11-unix # Required for GUI applications
command: /bin/bash
Expand Down
12 changes: 6 additions & 6 deletions docker/docker-compose-rt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ services:
image: frostlab/cougars:latest
platform: linux/arm64
container_name: cougars
user: frostlab
user: ${UNAME}
network_mode: host
privileged: true
volumes:
- ../bag:/home/frostlab/bag:rw
- ../config:/home/frostlab/config:rw
- ../cougars-ros2:/home/frostlab/ros2_ws
- ../cougars-teensy:/home/frostlab/teensy_ws
- ../cougars-gpio:/home/frostlab/gpio
- ../bag:/home/${UNAME}/bag:rw
- ../config:/home/${UNAME}/config:rw
- ../cougars-ros2:/home/${UNAME}/ros2_ws
- ../cougars-teensy:/home/${UNAME}/teensy_ws
- ../cougars-gpio:/home/${UNAME}/gpio
- /etc/localtime:/etc/localtime:ro # Syncs the container's time with the host
- /dev:/dev:rw
- /run/udev:/run/udev:ro
Expand Down

0 comments on commit 1d36f18

Please sign in to comment.