-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerfile to build a portable testing environment #324
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 --rm -ti libreant-box | ||
# | ||
# or, having managed to install libreant in a virtualenv on the local | ||
# development directory: | ||
# | ||
# docker run --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 |
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 & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can't we just inline this command There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a Dockerfile each RUN /libreant/ve/bin/libreant --fsdb-path /fsdb-store & the following RUN will not have any libreant service up. This is why I wrote the daemon and put in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, I just meant There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think we could do it but I liked the idea of having a |
||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why using a virtualenv if we are on an ephemeral container? There won't be any conflict with other python packages version since there will be only libreant installed.