Skip to content

Commit

Permalink
Issue #1: Added Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
hkage committed Jan 11, 2016
1 parent 9faad19 commit 3dab455
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ dist

# Vagrant
.vagrant
.bash_history
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM debian:stable

MAINTAINER Henning Kage "[email protected]"

USER root

# Link the project directory
ADD . /app

# Set environment variables
ENV PYTHON_VERSION 2.7

# Install basic requirements
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends build-essential openssh-client git git-core python-pip procps net-tools wget unzip python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python-distribute

# Install the requirements and run the application
RUN (cd /app && python setup.py install)
#CMD (cd /app && python run.py --port=8000 --logging=debug)

RUN chown -R www-data: /app

CMD ["python", "/app/run.py"]

EXPOSE 8000
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,15 @@ start the development server with the following command:

$ vagrant up
$ fab vagrant devserver

You can now access your application via `http://localhost:8000`

Docker
---

To run the application within Docker, you need to build and then run the image:

$ sudo docker build --tag=tornado-app --rm=true .
$ sudo docker run -p 8000:8000 -t -i tornado-app:latest

You can now access your application via `http://localhost:8000`
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network :forwarded_port, guest: 8888, host: 8888, id: "tornado"
config.vm.network :forwarded_port, guest: 8000, host: 8000, id: "tornado"
config.vm.synced_folder ".", "/home/vagrant"
config.vm.provision :shell, :path => "bootstrap.sh"
end
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tornado.options import define


define("port", default=8888, help="run on the given port", type=int)
define("port", default=8000, help="run on the given port", type=int)
define("config", default=None, help="tornado config file")
define("debug", default=False, help="debug mode")

Expand Down

0 comments on commit 3dab455

Please sign in to comment.