Skip to content

Commit

Permalink
Do @thaJeztah container efficiency suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
sekka1 authored and Silex committed Sep 6, 2016
1 parent 1ec5081 commit cc51050
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
FROM ubuntu:14.04.4

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

EXPOSE 57575

ENTRYPOINT ["/opt/run.sh"]
CMD ["butterfly.server.py", "--unsecure", "--host=0.0.0.0"]
ENTRYPOINT ["docker/run.sh"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Starting with login and password
docker run \
--env PASSWORD=password \
-p 57575:57575 \
-d garland/butterfly --unsecure --host=0.0.0.0 --port=57575 --login
-d garland/butterfly --port=57575 --login
```

Starting with no password
Expand All @@ -123,5 +123,5 @@ Starting with no password
docker run \
--env PORT=57575 \
-p 57575:57575 \
-d garland/butterfly --unsecure --host=0.0.0.0 --port=57575
-d garland/butterfly --port=57575
```
14 changes: 11 additions & 3 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/bin/sh -x
#!/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

/opt/app/butterfly.server.py $@
exec "$@"

0 comments on commit cc51050

Please sign in to comment.