Skip to content

Commit

Permalink
Dockerfile to build a portable testing environment
Browse files Browse the repository at this point in the history
  • Loading branch information
blallo committed Dec 4, 2017
1 parent 0b8c171 commit b2f8189
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
76 changes: 76 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# A Dockerfile to build a development environment for
#
# MM MMMMM
# MM MMMMMMM MMM
# MMMM MMMMMMMMM MMMMM MMMMMMMMMM
# MM MMMMMMMMM MMM MM MMMMMMMMMMMMMMM
# MMMMMM M MMMMMMMMMM MM MMMMMMMMMMMMMMMMMM
# MM M MMMMMMMMM MMMMMMMMMMMMMMMMMMMM
# MM MMM M MMMMMMMMMMMMMMMMMMMMMMMMMMMMM
# MMMMMMMMMMMMM MMMM MMMMMMMMMMMMMMMMMMMMMMMMM
# MMMMMMMMMMMMMM MMM MMMM MMMMMMMMMMMMMMMMMMMMMMMM
# MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
# MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
# MMMMMMMMMMMMM MMMMMMMMMMMMMMMM MMMMMMMMMMMMMMM MMMMMMMM
# M MMMM MM MMMMMMMM MMMMM MMMMMMMMMMMMMMM MM
# MMM MM MM MMM MMMM MMMMMMMMM MM
# MM M MMMMM MMMMMM MMMMMMMMMM MM
# MMM MMMMMM MMMM M MMMMMMMMMMMM MM
# MMM MM M MM MM MMMMMMMMMMMMM
# MMM MM M MM MM MMMMMMMMMMMMMMM
# MM MM M MM MM MMMMMMMMMMMMMM
# MMM MM MM MMM MMMM MMMMMMMMMMMM
# MMM MMM MMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM MM MMM MMMMMMMMMM
# MMM MMM MMMMMMMMMMMMMMMMMMMM MMMMMMMMM MMMMMMMMM MMMM MMM MMMMMMMMMM
# MMM MMM MMMMMM MMM MMM MMM MMM MMM MMMMMMMMM MMMMMMM
# MMM MMM MMMMMMMMM MMM MMM MMMMMMMMM MMM MMM MM MMMMMM MMMM
# MMM MMM MMMMMMMMMMMMMMMMMMMM MMMMMMMMM MM MMM MM MMM MMMM
# MMM MM MMM MMM MMMMMM MMM MMM MMMMMMMM MM MMM MMMM
# MMMMMMMM MMM MMMMMMMMMMMMM MMM MMMMMMMMM MM MMM MM MMM MMMM
# MMMMMMMM MMM MMMMMMMMMMMMM MMM MMMMMMMMM MM MMM MM MMM MMMM
#
#
# To build run the following from the root of the libreant directory:
#
# docker build -t libreant-box .
#
# To start the container and operate inside it run:
#
# docker run --privileged --rm -ti libreant-box
#
# or, having managed to install libreant in a virtualenv on the local
# development directory:
#
# docker run --privileged --rm -v $PWD:/libreant -ti libreant-box
#
# The last will mount the local directory onto the /libreant directory into the
# container, allowing to test editis inside it.
#
FROM debian:stretch

RUN apt-get update && apt-get install -y \
systemd wget gnupg apt-transport-https \
python2.7 gcc python2.7-dev python-virtualenv
# Add ES gpg key for their repository
RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch|tee /tmp/ES.key|\
gpg -|grep -q "46095ACC8548582C1A2699A9D27D666CD88E42B4" &&\
cat /tmp/ES.key|apt-key add -
RUN echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" |\
tee -a /etc/apt/sources.list.d/elastic-6.x.list
RUN apt-get update && apt-get install -y \
# install ES version 6 and python2 requirements
openjdk-8-jre-headless elasticsearch
# Copy libreant directory to /libreant into the container
ADD . /libreant
WORKDIR /libreant
# Coping the SysVint script to appropriate directory
RUN mv libreantd /etc/init.d/
# Installing libreant
RUN virtualenv -p $(which python2) ve && ./ve/bin/pip install -e . &&\
# Installing fsdb ;)
./ve/bin/pip install Fsdb
RUN mkdir /fdsb-store

EXPOSE 5000

ENTRYPOINT service elasticsearch start && service libreantd start && bash -i
31 changes: 31 additions & 0 deletions libreantd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
start_libreant_daemon(){
if [ -f /libreant/ve/bin/libreant ];
then
/libreant/ve/bin/libreant --fsdb-path /fsdb-store &
fi
}

stop_libreant_daemon(){
pkill libreant
}

case "$1" in
start)
echo "Starting libreant"
start_libreant_daemon
;;
stop)
echo "Stopping libreant"
stop_libreant_daemon
;;
restart)
echo "Stopping libreant" &&\
stop_libreant_daemon &&\
echo "Starting libreant" &&\
start_libreant_daemon
;;
*)
echo "Usage: $0 (start|stop|restart)" >&2
exit 1
;;
esac

0 comments on commit b2f8189

Please sign in to comment.