Skip to content

Commit

Permalink
Merge pull request marians#4 from marians/dockerize
Browse files Browse the repository at this point in the history
Dockerize
  • Loading branch information
marians committed Mar 23, 2015
2 parents 5376ead + c992764 commit ee41503
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM debian:wheezy

MAINTAINER Marian Steinbach <[email protected]>

ENV DEBIAN_FROMTEND noninteractive

RUN apt-get update -q

RUN apt-get install -qy --no-install-recommends python-pip build-essential python-dev

ADD requirements.txt /requirements.txt

RUN pip install -r requirements.txt

ADD runserver.py /runserver.py
ADD static /static
ADD templates /templates

ENTRYPOINT ["python", "-u", "runserver.py"]
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
docker-build:
# Building the docker image "rebrow"
docker build -t rebrow .

docker-testrun:
# Running the docker image, linked to a redis container
docker run --rm -ti -p 5001:5001 --link redis:redis -e "SECRET_KEY=abc123" rebrow
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ Execute this:

Then open [127.0.0.1:5001](http://127.0.0.1:5001).

## Running as Docker container

If you run redis in a Docker container, the recommended way is to run rebrow in it's own Docker container, too. The provided `Dockerfile` can be used to create the according image. The `Makefile` contains example commands to build the image and run a container from the image.

When running the image, make sure to get your links right. For example, if your redis server is running in a container named `myredis`, start your rebrow container like this:

```
docker run --rm -ti -p 5001:5001 --link myredis:myredis rebrow
```

Then access rebrow via `http://<your-docker-ip>:5001/` and set the host name in the login screen to `myredis`.

## License

MIT licensed. See file LICENSE for details.
Expand Down
7 changes: 4 additions & 3 deletions runserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import redis
import time
from datetime import datetime, timedelta
import os

app = Flask(__name__)


app.secret_key = "lasfuoi3ro8w7gfow3bwiubdwoeg7p23r8g23rg"
# key for cookie safety. Shal be overridden using ENV var SECRET_KEY
app.secret_key = os.getenv("SECRET_KEY", "lasfuoi3ro8w7gfow3bwiubdwoeg7p23r8g23rg")

# Description of info keys
# TODO: to be continued.
Expand Down Expand Up @@ -236,4 +237,4 @@ def key(host, port, db, key):


if __name__ == "__main__":
app.run(debug=True, port=5001)
app.run(host="0.0.0.0", debug=False, port=5001)

0 comments on commit ee41503

Please sign in to comment.