Skip to content

Instantly share code, notes, and snippets.

@simeg
Created September 17, 2017 18:30
Show Gist options
  • Save simeg/6203d6642df1b09a4e11b9e3c4aef812 to your computer and use it in GitHub Desktop.
Save simeg/6203d6642df1b09a4e11b9e3c4aef812 to your computer and use it in GitHub Desktop.
Dockerfiles for Python 2 & 3 with uWSGI
# Taken from post in https://github.com/gliderlabs/docker-alpine/issues/158
FROM gliderlabs/alpine:latest
# install system packages
RUN apk add --update --no-cache \
python \
python-dev \
build-base \
linux-headers \
pcre-dev \
py-pip \
curl \
openssl \
nginx \
rsyslog
# pip
RUN pip install --upgrade pip
RUN pip install https://github.com/unbit/uwsgi/archive/uwsgi-2.0.zip#egg=uwsgi
# ----------------------------------------------------------------------------
# My own Dockerfile based on the one above (Python 3)
FROM gliderlabs/alpine:3.6
RUN apk add --update --no-cache \
py-pip \
python3 \
python2-dev \
python3-dev \
build-base \
linux-headers \
curl
ADD . /
RUN pip3 install --upgrade pip
RUN pip3 install uwsgi
RUN pip3 install -r requirements.txt
EXPOSE 8000
ENTRYPOINT ["uwsgi", "--http", "0.0.0.0:8000", "--module", "app:app", "--processes", "1", "--threads", "8"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment