Skip to content

Instantly share code, notes, and snippets.

@digital-shokunin
Last active July 14, 2016 04:04
Show Gist options
  • Save digital-shokunin/fdfdc2f9230171b7fef6 to your computer and use it in GitHub Desktop.
Save digital-shokunin/fdfdc2f9230171b7fef6 to your computer and use it in GitHub Desktop.
Dockerfile for uwsgi/nginx/with flask install
############################################################
# Dockerfile to build Python Nginx/uWSGI/Flask Application Containers
# Based on Ubuntu
############################################################
# Set the base image to Ubuntu
FROM icecreammatt/flask
# File Author / Maintainer
MAINTAINER David Mitchell
RUN apt-get update
# Install basic applications
RUN apt-get install -y tar git curl vim wget dialog net-tools build-essential
# Install Python and Basic Python Tools
RUN apt-get install -y python python-dev python-distribute python-pip
#Configure uwsgi
WORKDIR /etc/uwsgi/apps-available
RUN curl -O https://gist.github.com/digital-shokunin/226f9cd8b4f430eedfeb/raw/a587353b7c3378760132ca13e2742d0e378720dd/uwsgi_flask.ini
RUN ln -s uwsgi_flask.ini /etc/uwsgi/apps-enabled/uwsgi_flask.ini
WORKDIR /etc/nginx/sites-available
RUN curl -O https://gist.github.com/digital-shokunin/226f9cd8b4f430eedfeb/raw/25da1d1279013173f2263c1cb859d530bd4de1da/nginx_flask.conf
RUN ln -s nginx_flask.conf /etc/nginx/sites-enabled/nginx_flask.conf
#Put app in /webapps
RUN mkdir /webapps
WORKDIR /webapps
#Deploy app from git repo
RUN git clone https://github.com/digital-shokunin/flask-example.git
RUN chown -R www-data /webapps
RUN pip install -r /webapps/requirements.txt
RUN pip install uwsgi
# Expose ports
EXPOSE 80
# Start the services
RUN service uwsgi start
RUN service nginx start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment