Skip to content

Instantly share code, notes, and snippets.

@wonderbeyond
Last active August 14, 2019 13:08
Show Gist options
  • Save wonderbeyond/61a43bc25121031891b9a3321d19acf5 to your computer and use it in GitHub Desktop.
Save wonderbeyond/61a43bc25121031891b9a3321d19acf5 to your computer and use it in GitHub Desktop.
Dockerfile: python3+pipenv+sanic+gunicorn
FROM python:3.6
RUN /bin/echo -e \
"deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib\n"\
"deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib\n"\
"deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib\n"\
"deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib\n"\
> /etc/apt/sources.list
# build deps
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
git
# Web app source code
COPY . /code
WORKDIR /code
RUN set -ex && pip install -U pipenv
RUN set -ex && pipenv install --deploy --system
# ENV APP_ENV=prod
ENV APP_ENV=dev
CMD [ \
"gunicorn", \
"--bind=0.0.0.0:8600", \
"--worker-class=sanic.worker.GunicornWorker", \
"--workers=2", \
"--access-logfile=-", \
"app:app" \
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment