diff --git a/Dockerfile b/Dockerfile index 85b13161..6946ae8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,25 +14,31 @@ from ubuntu:precise -maintainer Dockerfiles +maintainer baxeico run echo "deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted" | tee -a /etc/apt/sources.list.d/precise-updates.list +# update packages run apt-get update -run apt-get install -y git -run apt-get install -y python python-dev python-setuptools -run apt-get install -y nginx supervisor + +# install required packages +run apt-get install -y python python-dev python-setuptools python-software-properties +run apt-get install -y sqlite3 +run apt-get install -y supervisor + +# add nginx stable ppa +run add-apt-repository -y ppa:nginx/stable +# update packages after adding nginx repository +run apt-get update +# install latest stable nginx +run apt-get install -y nginx + +# install pip run easy_install pip # install uwsgi now because it takes a little while run pip install uwsgi -# install nginx -run apt-get install -y python-software-properties -run apt-get update -run add-apt-repository -y ppa:nginx/stable -run apt-get install -y sqlite3 - # install our code add . /home/docker/code/ @@ -47,7 +53,8 @@ run pip install -r /home/docker/code/app/requirements.txt # install django, normally you would remove this step because your project would already # be installed in the code/app/ directory -run django-admin.py startproject website /home/docker/code/app/ +run django-admin.py startproject website /home/docker/code/app/ +run cd /home/docker/code/app && ./manage.py syncdb --noinput expose 80 cmd ["supervisord", "-n"] diff --git a/README.md b/README.md index 826a8b17..95c21f9b 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,21 @@ elinimating overhead. Most of this setup comes from the excellent tutorial on https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html +This repo is a fork of https://github.com/dockerfiles/django-uwsgi-nginx, +I made some fixes to have the image working out-of-the-box. + Feel free to clone this and modify it to your liking. And feel free to contribute patches. ### Build and run * docker build -t webapp . -* docker run -d webapp +* docker run -d -p 80:80 webapp + +### Test + +`curl localhost` + +You should see the HTML source of Django welcome page. ### How to insert your application