Skip to content

Commit

Permalink
Dockerize the app
Browse files Browse the repository at this point in the history
Had to update gevent because of an ssl error with the previous version
that caused issues when running in Docker.
  • Loading branch information
Graham42 committed Jan 5, 2017
1 parent 27382c0 commit 3d8e9eb
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM python:2.7-alpine

RUN apk update && apk upgrade && \
apk add \
gcc python python-dev py2-pip \
# greenlet
musl-dev \
# sys/queue.h
bsd-compat-headers \
# event.h
libevent-dev \
&& rm -rf /var/cache/apk/*

# want all dependencies first so that if it's just a code change, don't have to
# rebuild as much of the container
ADD requirements.txt /opt/requestbin/
RUN pip install -r /opt/requestbin/requirements.txt \
&& rm -rf ~/.pip/cache

# the code
ADD requestbin /opt/requestbin/requestbin/

EXPOSE 8000

WORKDIR /opt/requestbin
CMD gunicorn -b 0.0.0.0:8000 --worker-class gevent --workers 2 --max-requests 1000 requestbin:app


17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ Now just deploy via git:
It will push to Heroku and give you a URL that your own private RequestBin will be running.


## Deploy your own instance using Docker

On the server/machine you want to host this, you'll first need a machine with
docker and docker-compose installed, then grab the RequestBin source using git:

`$ git clone git://github.com/Runscope/requestbin.git`

Go into the project directory and then build and start the containers

```
$ sudo docker-compose build
$ sudo docker-compose up -d
```

Your own private RequestBin will be running on this server.


Contributors
------------
* Barry Carlyon <[email protected]>
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
app:
build: .
environment:
REALM: prod
REDIS_URL: "//redis:6379"
links:
- redis
ports:
- "8000:8000"

redis:
image: redis
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gevent==0.13.8
gevent==1.0.2
greenlet==0.4.1
ProxyTypes==0.9
nose==1.3.0
Expand Down

0 comments on commit 3d8e9eb

Please sign in to comment.