Added Dockerfiles for automatic builds on docker hub.

This commit is contained in:
Jorrit Wronski
2015-10-11 13:19:47 +02:00
parent f3c8f24e47
commit 0b09f5261e
5 changed files with 100 additions and 51 deletions

View File

@@ -29,7 +29,7 @@ environment = jinja2.Environment(loader=loader)
# 1) System packages
lin_dev_pkgs = ["python-dev", "python-pip", "build-essential" ]
lin_dev_pkgs += ["libhdf5-serial-dev", "libnetcdf-dev", "liblapack-dev", "libatlas-dev"]
lin_dev_pkgs += ["gfortran", "gcc", "cmake", "bash", "rsync"]
lin_dev_pkgs += ["gfortran", "gcc", "cmake", "bash", "rsync", "git"]
lin_dev_pkgs += ["curl", "wget"]
# 2) pip packages
@@ -61,56 +61,6 @@ local_dict = dict(
cnd_env = cnd_env,
cnd_dev_pkgs = cnd_dev_pkgs+cnd_run_pkgs,
)
env_example="""SLAVEDIR=/home/buildbot/slavedir
MASTERHOST=coolprop.dreamhosters.com:port
SLAVENAME=slavename
SLAVEPASSWORD=pass
BOTADMIN=Author Name
BOTEMAIL=noreply@coolprop.org
BOTHOST=A short description of the host computer
"""
target = 'Dockerfile.slave.env.list'
f = codecs.open(os.path.join(tar_dir,target),mode='wb',encoding='utf-8')
f.write(env_example)
f.close()
#
entry_script="""#!/bin/bash
CTRLAPP="/usr/local/bin/buildslave"
function shutdown()
{
if [ ! -d "${SLAVEDIR}" ]; then
/usr/local/bin/buildslave create-slave ${SLAVEDIR} ${MASTERHOST} ${SLAVENAME} ${SLAVEPASSWORD}
echo "${BOTADMIN} <${BOTEMAIL}>" > ${SLAVEDIR}/info/admin
echo "${BOTHOST}" > ${SLAVEDIR}/info/host
fi
$CTRLAPP stop ${SLAVEDIR} & wait
exit 0
}
function startup()
{
$CTRLAPP start ${SLAVEDIR} & wait
}
trap shutdown TERM SIGTERM SIGKILL SIGINT
startup;
# Just idle for one hour and keep the process alive
# waiting for SIGTERM.
while : ; do
sleep 3600 & wait
done
#
echo "The endless loop terminated, something is wrong here."
exit 1
"""
target = 'Dockerfile.slave.entrypoint.sh'
f = codecs.open(os.path.join(tar_dir,target),mode='wb',encoding='utf-8')
f.write(entry_script)
f.close()
os.chmod(os.path.join(tar_dir,target), 0o755)
#
target = 'Dockerfile.slave.base'
template_path = target+'.tpl'

View File

@@ -0,0 +1,29 @@
# 2015-10-11 13:30 CAUTION: This file is automatically generated from Dockerfile.slave.base.tpl, do not edit it manually.
# Set the base image to Debian
FROM debian:testing
# File Author / Maintainer
MAINTAINER Jorrit Wronski (jowr@ipu.dk)
#
#
RUN apt-get update -qq && \
apt-get install -y python-dev python-pip build-essential libhdf5-serial-dev libnetcdf-dev liblapack-dev libatlas-dev gfortran gcc cmake bash rsync git curl wget && \
apt-get clean
#
RUN pip install buildbot-slave
#
RUN groupadd -r buildbot && \
useradd -r -d /home/buildbot -m -s /bin/bash -g buildbot buildbot # && mkdir /buildslave && chown buildbot:buildbot /buildslave
#
RUN rm /bin/sh && ln -sf /bin/bash /bin/sh
USER buildbot
WORKDIR /home/buildbot
#
#RUN \
#cat .ssh/known_hosts
#
#RUN buildslave create-slave ${SLAVEDIR} ${MASTERHOST} ${SLAVENAME} ${SLAVEPASSWORD}
#ENTRYPOINT ["/usr/local/bin/buildslave"]
#CMD ["start", "--nodaemon"]
#
COPY ./Dockerfile.slave.entrypoint.sh /
ENTRYPOINT ["/Dockerfile.slave.entrypoint.sh"]

View File

@@ -0,0 +1,30 @@
#!/bin/bash
CTRLAPP="/usr/local/bin/buildslave"
function shutdown()
{
$CTRLAPP stop ${SLAVEDIR}
exit 0
}
function startup()
{
if [ ! -d "${SLAVEDIR}" ]; then
/usr/local/bin/buildslave create-slave ${SLAVEDIR} ${MASTERHOST} ${SLAVENAME} ${SLAVEPASSWORD}
echo "${BOTADMIN} <${BOTEMAIL}>" > ${SLAVEDIR}/info/admin
echo "${BOTHOST}" > ${SLAVEDIR}/info/host
fi
$CTRLAPP start ${SLAVEDIR}
}
trap shutdown TERM SIGTERM SIGKILL SIGINT
startup;
# Just idle for one hour and keep the process alive
# waiting for SIGTERM.
while : ; do
sleep 3600 & wait
done
#
echo "The endless loop terminated, something is wrong here."
exit 1

View File

@@ -0,0 +1,7 @@
SLAVEDIR=/home/buildbot/slavedir
MASTERHOST=bots.coolprop.org:port
SLAVENAME=slavename
SLAVEPASSWORD=pass
BOTADMIN=Author Name
BOTEMAIL=noreply@coolprop.org
BOTHOST=A short description of the host computer

View File

@@ -0,0 +1,33 @@
# 2015-10-11 13:30 CAUTION: This file is automatically generated from Dockerfile.slave.python.tpl, do not edit it manually.
# Set the base image to Debian
FROM coolprop/slavebase
# File Author / Maintainer
MAINTAINER Jorrit Wronski (jowr@ipu.dk)
#
#
USER buildbot
WORKDIR /home/buildbot
#
RUN curl -o miniconda.sh http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh && \
chmod +x miniconda.sh && ./miniconda.sh -b && rm miniconda.sh && \
echo "export PATH=/home/buildbot/miniconda3/bin:/home/buildbot/miniconda/bin:$PATH" >> /home/buildbot/.bash_profile
#
env PATH /home/buildbot/miniconda3/bin:/home/buildbot/miniconda/bin:$PATH
#
RUN \
conda create -n CoolProp27 python=2.7 cython pip jinja2 pyyaml pycrypto numpy scipy matplotlib pandas && \
conda create -n CoolProp33 python=3.3 cython pip jinja2 pyyaml pycrypto numpy scipy matplotlib pandas && \
conda create -n CoolProp34 python=3.4 cython pip jinja2 pyyaml pycrypto numpy scipy matplotlib pandas && \
conda clean -yilts
#
#RUN \
#source activate CoolProp27 && \
#pip install wheel && \
#source deactivate && \
#source activate CoolProp33 && \
#pip install wheel && \
#source deactivate && \
#source activate CoolProp34 && \
#pip install wheel && \
#source deactivate && \
#conda clean -yilts