Skip to content

Instantly share code, notes, and snippets.

@tkremmel
Last active August 29, 2015 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkremmel/237b183a30f0f399de67 to your computer and use it in GitHub Desktop.
Save tkremmel/237b183a30f0f399de67 to your computer and use it in GitHub Desktop.
simpleloop - Dockerfile to build web host container images
############################################################
# Dockerfile to build web host container images
# Based on Ubuntu, Django, uwsgi, and Nginx
############################################################
# Set the base image to Ubuntu
FROM ubuntu:14.04
# File Author / Maintainer
MAINTAINER TK - simpleloop
################## BEGIN INSTALLATION ######################
# Run installation cmds
RUN apt-get update
RUN apt-get install -y tar
RUN apt-get install -y git
RUN apt-get install -y curl
RUN apt-get install -y vim
RUN apt-get install -y wget
RUN apt-get install -y dialog
RUN apt-get install -y net-tools
RUN apt-get install -y build-essential
#RUN apt-get install -y python python-dev python-distribute python-pip
RUN apt-get install -y python-pip libpq-dev python-dev python-setuptools
RUN apt-get install -y libncurses5-dev
RUN apt-get install -y nginx supervisor
# install uwsgi now because it takes a little while
RUN pip install uwsgi
# install nginx
RUN apt-get install -y software-properties-common python-software-properties
RUN apt-get update
RUN add-apt-repository -y ppa:nginx/stable
RUN apt-get install -y sqlite3
# add the host code
ADD ./conf /home/docker/conf/
ADD ./app /home/docker/app/
ADD ./bin /home/docker/bin/
# setup folders
RUN mkdir -p /var/log/app/
RUN mkdir -p /var/www/vhosts/simpleloop/static/
RUN mkdir -p /var/www/app/media
# Create a nonroot user
RUN /usr/sbin/useradd --create-home --home-dir /usr/local/nonroot --shell /bin/bash nonroot
# setup permissions
RUN chmod +x /home/docker/bin/ -R
RUN chown -R nonroot /var/log/
RUN chown -R nonroot /var/log/app/
RUN chown -R nonroot /home/docker/app/
################## END INSTALLATION ######################
################## START CONFIGURATION ######################
# setup all the configfiles
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN rm /etc/nginx/sites-enabled/default
RUN ln -s /home/docker/conf/nginx-app.conf /etc/nginx/sites-enabled/
RUN ln -s /home/docker/conf/supervisor-app.conf /etc/supervisor/conf.d/
# run pip install
RUN pip install -r /home/docker/app/Simpleloop_Company_Page/requirements.txt
expose 80
################## END CONFIGURATION ######################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment