Skip to content

Commit

Permalink
Add docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Jul 7, 2015
1 parent e573540 commit a90695b
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
all: help

help:
@echo ""
@echo "-- Help Menu"
@echo ""
@echo " 1. make build - build all pprz images"
@echo " 1. make pull - pull all pprz images"
@echo " 1. make clean - remove all pprz images"
@echo " 2. make bash - run bash on pprz-dev"
@echo " 2. make paparazzi - run paparazzi center on pprz-dev"
@echo ""

build:
@docker build --tag=flixr/pprz-dep dep/.
@docker build --tag=flixr/pprz-dev dev/.

pull:
@docker pull flixr/pprz-dep
@docker pull flixr/pprz-dev

clean:
@docker rmi -f flixr/pprz-dep
@docker rmi -f flixr/pprz-dev

bash:
@bash run.sh -i -t flixr/pprz-dev bash

paparazzi:
@bash run.sh -i -t flixr/pprz-dev ./paparazzi
31 changes: 31 additions & 0 deletions docker/dep/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#From inside this folder
# docker build -t flixr/pprz-dep .
# docker run -t -i flixr/pprz-dep /bin/bash
# docker export pprz-dep | gzip -c > pprz-dep.tgz
# docker import pprz-dep < pprz-dep.tgz

# Use phusion/baseimage as base image.
FROM phusion/baseimage:0.9.16
MAINTAINER Felix Ruess <felix.ruess@gmail.com>

# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]

# Set the env variable DEBIAN_FRONTEND to noninteractive
ENV DEBIAN_FRONTEND noninteractive

# add Paparazzi PPA
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository ppa:paparazzi-uav/ppa

# install paparazzi-dev which pull in the dependencies
# also install cross compiler and some stuff for X
RUN apt-get update && apt-get install -y \
gcc-arm-none-eabi \
libcanberra-gtk-module \
paparazzi-dev \
paparazzi-jsbsim \
x11-apps

# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
4 changes: 4 additions & 0 deletions docker/dep/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#Paparazzi-dep
This is the base images with dependencies of the Paparazzi-UAV project.

[Paparazzi-UAV](https://paparazziuav.org) is a free and open-source hardware and software project encompassing an exceptionally powerful and versatile autopilot system for fixedwing aircrafts as well as multicopters.
27 changes: 27 additions & 0 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#From inside this folder
# docker build -t flixr/pprz-dev .
# docker run -t -i flixr/pprz-dev /bin/bash
# run with X11 forwarding:
# sudo docker run -t -i -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix flixr/pprz-dev /bin/bash

FROM flixr/pprz-dep
MAINTAINER Felix Ruess <felix.ruess@gmail.com>

ENV PULSE_SERVER /run/pulse/native

# add basic user
ENV USERNAME pprz
RUN useradd -m $USERNAME && \
echo "$USERNAME:$USERNAME" | chpasswd && \
usermod --shell /bin/bash $USERNAME && \
usermod -aG sudo $USERNAME && \
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME && \
usermod --uid 1000 $USERNAME && \
groupmod --gid 1000 $USERNAME

# change user
USER pprz

ENV HOME /home/$USERNAME
WORKDIR $HOME
4 changes: 4 additions & 0 deletions docker/dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#Paparazzi-dev
This is the development pprz user image of the Paparazzi-UAV project.

[Paparazzi-UAV](https://paparazziuav.org) is a free and open-source hardware and software project encompassing an exceptionally powerful and versatile autopilot system for fixedwing aircrafts as well as multicopters.
44 changes: 44 additions & 0 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh

#set -x

# if no arguments given, start with interactive terminal
if test $# -lt 1; then
args="-t -i flixr/pprz-dev /sbin/my_init -- bash"
else
# Use this script with derived images, and pass your 'docker run' args
args="$@"
fi

if [ -z "$PAPARAZZI_HOME" ]; then
SCRIPT=$(readlink -f $0)
SCRIPT_DIR=$(dirname $(readlink -f $0))
PAPARAZZI_HOME=$(readlink -m $SCRIPT_DIR/..)
fi

# PAPARAZZI_HOME inside the container
PPRZ_HOME_CONTAINER=/home/pprz/paparazzi


USER_UID=$(id -u)
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -

docker run \
--rm \
--volume=/run/user/${USER_UID}/pulse:/run/pulse \
--volume=$XSOCK:$XSOCK \
--volume=$XAUTH:$XAUTH \
--env="XAUTHORITY=${XAUTH}" \
--env="DISPLAY=${DISPLAY}" \
--volume=$PAPARAZZI_HOME:$PPRZ_HOME_CONTAINER \
--env="PAPARAZZI_HOME=$PPRZ_HOME_CONTAINER" \
--env="PAPARAZZI_SRC=$PPRZ_HOME_CONTAINER" \
-u pprz \
-w $PPRZ_HOME_CONTAINER \
$args

# cleanup XAUTHORITY file again
rm -f $XAUTH

0 comments on commit a90695b

Please sign in to comment.