Skip to content
This repository was archived by the owner on Feb 21, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions scripts/docker/build_dockers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import docker
import yaml
import sys




yamlFile = sys.argv[1]
client = docker.from_env()
images={}


## Build Image ##
def build_image(ipath, itag):
try:
client.images.build(pull=True, path=ipath, tag=itag, rm=True, stream=True)
except docker.errors.BuildError as exc:
print(exc)
except docker.errors.APIError as exc:
print (exc)

## Push Image ##
def push_image(itag):
try:
client.images.push(itag)
except docker.errors.APIError as exc:
print (exc)




## Open File ##
with open(yamlFile, 'r') as stream:
try:
images=yaml.load(stream)
except yaml.YAMLError as exc:
print(exc)


for image in images:
if images[image]["build"]:
build_image(images[image]["path"], images[image]["tag"])
if images[image]["push"]:
push_image(images[image]["tag"])




37 changes: 37 additions & 0 deletions scripts/docker/docker_list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
ubuntu_base:
path: ubuntu/xenial/base
tag: "jderobot/ubuntu:base"
build: False
push: False

official:
path: jderobot/official
tag: "jderobot/jderobot"
build: False
push: False

###### DEVELOPMENT #######
dev-only-ice:
path: jderobot/dev-only-ice
tag: "jderobot/jderobot:dev-only-ice"
build: False
push: False

dev:
path: jderobot/dev
tag: "jderobot/jderobot:dev"
build: False
push: False

jenkins:
path: jenkins/dev
tag: "jderobot/jenkins:dev"
build: False
push: False

####### DEMOS #######
cameraviewjs:
path: jderobot/demos/cameraviewjs
tag: "jderobot/demos:cameraviewjs"
build: False
push: False
4 changes: 4 additions & 0 deletions scripts/docker/jderobot/dev-only-ice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,13 @@ RUN apt update && apt install -q -y \
&& rm -rf /var/lib/apt/lists/*


COPY ./testPR /bin/

RUN git config --global user.name "JdeRobot" && git config --global user.email johndoe@example.com


WORKDIR /root

RUN echo "source /opt/ros/kinetic/setup.bash" >> /root/.bashrc


Expand Down
41 changes: 41 additions & 0 deletions scripts/docker/jderobot/dev-only-ice/testPR
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

function usage {
echo "usage: testPR remote branch directory MakeJobs"
exit
}


if [ "$1" == "-h" ]; then
usage
fi

if (($# < 3)); then
usage
fi


local=jderobot
remote=$1
branch=$2
directory=$3
makejob=$4

if [ -z "$makejob" ]
then
makejob=1
fi


git clone https://github.com/$local/JdeRobot.git $directory
cd $directory

git remote add $remote https://github.com/$remote/JdeRobot.git
git fetch $remote
git merge --no-edit $remote/$branch

mkdir build && cd build

cmake ..
make install -j$makejob

1 change: 1 addition & 0 deletions scripts/docker/jderobot/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ LABEL manteiner Aitor Martínez Fernández+aitor.martinez.fernandez@gmail.com
RUN apt update && apt install -q -y \
ros-kinetic-roscpp ros-kinetic-std-msgs ros-kinetic-cv-bridge ros-kinetic-image-transport \
ros-kinetic-roscpp-core ros-kinetic-rospy ros-kinetic-nav-msgs ros-kinetic-geometry-msgs \
ros-kinetic-kobuki-gazebo \
&& rm -rf /var/lib/apt/lists/*


Expand Down
26 changes: 26 additions & 0 deletions scripts/docker/jenkins/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Own Ubuntu base
FROM jderobot/jderobot:dev

LABEL manteiner Aitor Martínez Fernández+aitor.martinez.fernandez@gmail.com


# install basic packages
RUN apt update && apt install -q -y \
whois \
openssh-server \
openjdk-8-jdk \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir /var/run/sshd

RUN useradd -p `mkpasswd jenkins` -d /home/jenkins -m -g users -s /bin/bash jenkins

RUN echo "source /opt/ros/kinetic/setup.bash" >> /home/jenkins/.bashrc

RUN /usr/sbin/sshd

COPY ./compile.sh /bin/




29 changes: 29 additions & 0 deletions scripts/docker/jenkins/dev/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

function check_result {

if [ "$?" != "0" ]; then
echo "Error"
clear
exit -1
else
echo "OK"
fi
}

source /opt/ros/kinetic/setup.bash

mkdir build && cd build
cmake .. $*
check_result

make -j6
check_result

# Package Debian
#cmake .
#cpack .
#check_result

#sudo chown jenkins -R /jenkins/ws/JdeRobot