Merge pull request #116 from Silex/master

Docker updates
This commit is contained in:
Mounier Florian
2016-09-06 10:12:12 +02:00
committed by GitHub
4 changed files with 74 additions and 51 deletions

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
.git
.gitignore
.dockerignore
Dockerfile
README.md
butterfly.png

View File

@@ -1,18 +1,25 @@
FROM ubuntu:14.04.1
FROM ubuntu:14.04
RUN apt-get update -y
RUN apt-get install -y python-setuptools python-dev build-essential libffi-dev libssl-dev
RUN apt-get update \
&& apt-get install -y -q --no-install-recommends \
build-essential \
libffi-dev \
libssl-dev \
python-dev \
python-setuptools \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*
WORKDIR /opt
ADD . /opt/app
WORKDIR /opt/app
RUN python setup.py build
RUN python setup.py install
RUN python setup.py build \
&& python setup.py install
ADD docker/run.sh /opt/run.sh
RUN chmod 777 /opt/run.sh
EXPOSE 57575
CMD ["/opt/run.sh"]
CMD ["butterfly.server.py", "--unsecure", "--host=0.0.0.0"]
ENTRYPOINT ["docker/run.sh"]

View File

@@ -24,16 +24,16 @@ Butterfly is a xterm compatible terminal that runs in your browser.
## Try it
```bash
$ pip install butterfly
$ pip install libsass # If you want to use themes
$ butterfly
``` bash
$ pip install butterfly
$ pip install libsass # If you want to use themes
$ butterfly
```
A new tab should appear in your browser. Then type
```bash
$ butterfly help
``` bash
$ butterfly help
```
To get an overview of butterfly features.
@@ -41,8 +41,8 @@ To get an overview of butterfly features.
## Run it as a server
```bash
$ butterfly.server.py --host=myhost --port=57575
``` bash
$ butterfly.server.py --host=myhost --port=57575
```
The first time it will ask you to generate the certificates (see: [here](http://paradoxxxzero.github.io/2014/03/21/butterfly-with-ssl-auth.html))
@@ -52,12 +52,12 @@ The first time it will ask you to generate the certificates (see: [here](http://
Systemd provides a way to automatically activate daemons when needed (socket activation):
```bash
$ cd /etc/systemd/system
# curl -O https://raw.githubusercontent.com/paradoxxxzero/butterfly/master/butterfly.service
# curl -O https://raw.githubusercontent.com/paradoxxxzero/butterfly/master/butterfly.socket
# systemctl enable butterfly.socket
# systemctl start butterfly.socket
``` bash
$ cd /etc/systemd/system
$ curl -O https://raw.githubusercontent.com/paradoxxxzero/butterfly/master/butterfly.service
$ curl -O https://raw.githubusercontent.com/paradoxxxzero/butterfly/master/butterfly.socket
$ systemctl enable butterfly.socket
$ systemctl start butterfly.socket
```
Don't forget to update the /etc/butterfly/butterfly.conf file with your server options (host, port, shell, ...)
@@ -74,7 +74,6 @@ If you want to motivate me to continue working on this project you can tip me, s
Client side development use [grunt](http://gruntjs.com/) and [bower](http://bower.io/).
## Credits
The js part is based on [term.js](https://github.com/chjj/term.js/) which is based on [jslinux](http://bellard.org/jslinux/).
@@ -82,35 +81,45 @@ The js part is based on [term.js](https://github.com/chjj/term.js/) which is bas
[Florian Mounier](http://paradoxxxzero.github.io/)
## License
```
butterfly Copyright (C) 2015 Florian Mounier
butterfly Copyright (C) 2015 Florian Mounier
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```
## Docker Usage
## Docker
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
### Example usage
docker run \
--env PASSWORD=password \
--env PORT=57575 \
-p 57575:57575 \
-d garland/butterfly
Starting with login and password
``` bash
docker run --env PASSWORD=password -d garland/butterfly --login
```
Starting with no password
``` bash
docker run -d -p 57575:57575 garland/butterfly
```
Starting with a different port
``` bash
docker run -d -p 12345:12345 garland/butterfly --port=12345
```

21
docker/run.sh Normal file → Executable file
View File

@@ -1,13 +1,14 @@
#!/bin/sh
#!/bin/bash -e
# if command starts with an option, prepend the default command and options
if [ "${1:0:1}" = '-' ]; then
set -- butterfly.server.py --unsecure --host=0.0.0.0 --port=${PORT:-57575} "$@"
elif [ "$1" = 'butterfly.server.py' ]; then
shift
set -- butterfly.server.py --unsecure --host=0.0.0.0 --port=${PORT:-57575} "$@"
fi
# Set password
echo "root:${PASSWORD}" | chpasswd
echo "root:${PASSWORD:-password}" | chpasswd
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
exec "$@"