Skip to content

Commit

Permalink
tested
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobDomislovic committed Nov 6, 2024
1 parent 374f7e0 commit 304bde5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 45 deletions.
58 changes: 17 additions & 41 deletions Dockerfile.binary
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
ARG VERSION=0.2.1
ARG DISTRO=focal
ARG BASE_IMAGE=nvidia/opengl:1.2-glvnd-runtime-ubuntu20.04
FROM lmark1/uav_ros_simulation:focal-bin-0.2.1

FROM lmark1/uav_ros_stack:$DISTRO-bin-$VERSION

# https://blog.alexellis.io/mutli-stage-docker-builds/ - Neat!
FROM $BASE_IMAGE

# Use ARG - persists only during docker build
# https://github.com/moby/moby/issues/4032#issuecomment-192327844
ARG CATKIN_WORKSPACE=sim_ws
ARG HOME=/root
ARG CATKIN_WORKSPACE=sim_ws
ARG USER=root
ENV DEBIAN_FRONTEND=noninteractive
ENV GITHUB_RUNNER=true
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

RUN apt-get update && apt-get install -q -y \
vim \
nano

WORKDIR $HOME/$CATKIN_WORKSPACE/src
RUN apt-get install openssh-client git
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts

# Install all the things to stop docker build from breaking
RUN ln -fs /usr/share/zoneinfo/Europe/Zagreb /etc/localtime && \
Expand All @@ -27,42 +23,22 @@ RUN ln -fs /usr/share/zoneinfo/Europe/Zagreb /etc/localtime && \
dialog \
curl \
vim \
nano \
tzdata \
openssh-client \
vim \
git \
bash-completion && \
dpkg-reconfigure --frontend noninteractive tzdata

# download public key for github.com
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts

# Install uav_ros_simulation and setup catkin workspace
WORKDIR $HOME
COPY --from=0 $HOME/uav_ws $HOME/uav_ws

RUN --mount=type=ssh git clone git@github.com:larics/uav_ros_simulation.git && \
./uav_ros_simulation/installation/install_and_setup_workspace.sh --workspace $CATKIN_WORKSPACE --sparse

# Build catkin workspace
WORKDIR $HOME/$CATKIN_WORKSPACE/src
SHELL ["/bin/bash", "-c"]

# Add sourcing
RUN echo "source $HOME/uav_ws/install/setup.bash" >> $HOME/.bashrc && \
# 1) remove uav_ws sourcing, need to add it after..
sed -i "s|source $HOME/$CATKIN_WORKSPACE/devel/setup.bash||g" $HOME/.bashrc
# Build the Catkin workspace
RUN catkin build --limit-status-rate 0.2

# Build
RUN source /root/.bashrc && \
catkin clean --yes && \
catkin config --extend /root/uav_ws/install && \
catkin build --limit-status-rate 0.2
ARG ROS_HOSTNAME=localhost.local
ARG ROS_MASTER_URI=http://localhost.local:11311
ARG ROS_IP=localhost.local

# 2) .. add source sim_ws NOW
RUN echo "source $HOME/$CATKIN_WORKSPACE/devel/setup.bash" >> $HOME/.bashrc && \
# 3) Expose uav_ws packages
echo 'export ROS_PACKAGE_PATH='"$HOME"'/uav_ws/install/share:$ROS_PACKAGE_PATH' >> $HOME/.bashrc

# Prepare for startup
WORKDIR $HOME/$CATKIN_WORKSPACE/src
WORKDIR $HOME/$CATKIN_WORKSPACE/src
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Prebuilt images for ```uav_ros_simulation``` found at [DockerHub lmark1/uav_ros_

UAV simulations are launched as tmuxinator sessions as follows.
```bash
cd ~/uav_ros_simulation/startup/kopterworx_one_flying
./start.sh
roscd uav_ros_simulation
./startup/kopterworx_one_flying/start.sh
```

To find out more about navigating the simulation environment please read [HOWTO.md](HOWTO.md).
Expand Down
2 changes: 1 addition & 1 deletion docker_build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ docker build \
--build-arg ROS_IP=$ROS_IP \
-f $DOCKERFILE \
--ssh default \
-t $IMAGE_NAME:$distro .
-t $IMAGE_NAME:$ros_distro .
2 changes: 1 addition & 1 deletion docker_run.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ docker run \
--env DISPLAY=$DISPLAY \
--env TERM=xterm-256color \
--name $full_container_name \
uav_ros_simulation:$distro \
uav_ros_simulation:focal \
/bin/bash

0 comments on commit 304bde5

Please sign in to comment.