From 6b2517ff93f70c6a370c6986990eeda66f3aaafc Mon Sep 17 00:00:00 2001 From: sekka1 Date: Tue, 27 Jan 2015 10:33:45 -0800 Subject: [PATCH 1/5] adding docker build and run files --- Dockerfile | 13 +++++++++++++ docker/run.sh | 6 ++++++ 2 files changed, 19 insertions(+) create mode 100644 Dockerfile create mode 100644 docker/run.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..65ce1c4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM ubuntu:14.04.1 + +RUN apt-get update -y +RUN apt-get install -y python-setuptools python-dev build-essential libffi-dev libssl-dev + +WORKDIR /opt +ADD . /opt/app +WORKDIR /opt/app + +RUN python setup.py build +RUN python setup.py install + +CMD ["docker/run.sh"] \ No newline at end of file diff --git a/docker/run.sh b/docker/run.sh new file mode 100644 index 0000000..f10bdfa --- /dev/null +++ b/docker/run.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# Set password +echo 'root:${PASSWORD}' | chpasswd + +./butterfly.server.py --unsecure --host=0.0.0.0 \ No newline at end of file From f7a4346aa0a0706f94b85839e6f1d30d391021c3 Mon Sep 17 00:00:00 2001 From: sekka1 Date: Tue, 27 Jan 2015 10:43:22 -0800 Subject: [PATCH 2/5] fixing password change --- Dockerfile | 3 +++ docker/run.sh | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 65ce1c4..86b80df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,7 @@ WORKDIR /opt/app RUN python setup.py build RUN python setup.py install +ADD docker/run.sh /opt/run.sh +RUN chmod 777 /opt/run.sh + CMD ["docker/run.sh"] \ No newline at end of file diff --git a/docker/run.sh b/docker/run.sh index f10bdfa..3489294 100644 --- a/docker/run.sh +++ b/docker/run.sh @@ -1,6 +1,6 @@ #!/bin/sh # Set password -echo 'root:${PASSWORD}' | chpasswd +echo "root:${PASSWORD}" | chpasswd -./butterfly.server.py --unsecure --host=0.0.0.0 \ No newline at end of file +/opt/app/butterfly.server.py --unsecure --host=0.0.0.0 \ No newline at end of file From 366ba5a67b7e85907ca1c9b1fa0c76456e5549e3 Mon Sep 17 00:00:00 2001 From: sekka1 Date: Tue, 27 Jan 2015 10:46:50 -0800 Subject: [PATCH 3/5] fixing docker command --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 86b80df..ed95b6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,4 @@ RUN python setup.py install ADD docker/run.sh /opt/run.sh RUN chmod 777 /opt/run.sh -CMD ["docker/run.sh"] \ No newline at end of file +CMD ["/opt/run.sh"] \ No newline at end of file From 7ec715cc38ed553ff20e4bf3a2e5f49852da1686 Mon Sep 17 00:00:00 2001 From: sekka1 Date: Tue, 27 Jan 2015 11:06:58 -0800 Subject: [PATCH 4/5] adding server port parameter --- Dockerfile | 2 ++ docker/run.sh | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ed95b6c..bc19a48 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,6 @@ RUN python setup.py install ADD docker/run.sh /opt/run.sh RUN chmod 777 /opt/run.sh +EXPOSE 57575 + CMD ["/opt/run.sh"] \ No newline at end of file diff --git a/docker/run.sh b/docker/run.sh index 3489294..4b4e7ec 100644 --- a/docker/run.sh +++ b/docker/run.sh @@ -3,4 +3,11 @@ # Set password echo "root:${PASSWORD}" | chpasswd -/opt/app/butterfly.server.py --unsecure --host=0.0.0.0 \ No newline at end of file +if [ -z ${PORT} ] +then + echo "Starting on default port: 57575" + /opt/app/butterfly.server.py --unsecure --host=0.0.0.0 +else + echo "Starting on port: ${PORT}" + /opt/app/butterfly.server.py --unsecure --host=0.0.0.0 --port=${PORT} +fi \ No newline at end of file From e1eb02ef80abf9565622fd379756c850bb663cf3 Mon Sep 17 00:00:00 2001 From: sekka1 Date: Tue, 27 Jan 2015 18:32:07 -0800 Subject: [PATCH 5/5] adding docker usage info --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 1e1cc68..e4ee1f4 100644 --- a/README.md +++ b/README.md @@ -67,3 +67,16 @@ Run `python dev.py --debug --port=12345` and you are set (yes you can launch it You should have received a copy of the GNU General Public License along with this program. If not, see . ``` + +## Docker Usage +There is a docker repository created for this project that is set to automatically rebuild when there is a push +into this repository: https://registry.hub.docker.com/u/garland/butterfly/ + +### Starting + + docker run \ + --env PASSWORD=password \ + --env PORT=57575 \ + -p 57575:57575 \ + -d garland/butterfly +