Skip to content

Instantly share code, notes, and snippets.

@syakesaba
Created March 23, 2017 14:36
Show Gist options
  • Save syakesaba/30ee8e3b839984cf5f86c27e1b8291e8 to your computer and use it in GitHub Desktop.
Save syakesaba/30ee8e3b839984cf5f86c27e1b8291e8 to your computer and use it in GitHub Desktop.
how_conda_source??.py
FROM continuumio/miniconda3:latest
MAINTAINER SYA-KE
#mb requirements.txt
#mv app
#app/app.py:
# def application:
# run port 9999
ENV APPDIR app
ENV APPMODULE app
ENV APPVAL application
ENV REQFILE requirements.txt
ENV UWSGI_PORT 9999
ENV APPENV appenv
ENV APPSCRIPT ${APPMODULE}.py
#install requirements.txt can be created executing "conda list -e"
ADD ./${REQFILE} /${APPENV}/${REQFILE}
#copy APPDIR
RUN mkdir -p /${APPENV}
ADD ${APPDIR} /${APPENV}/${APPDIR}
#buildtools uwsgi
RUN apt-get update && apt-get install -y gcc
#create environment
RUN /bin/bash -c "conda create -y -n ${APPENV} --file /${APPENV}/${REQFILE} \
&& source activate ${APPENV} \
&& pip install uwsgi \
&& uwsgi --chdir=/${APPENV}/${APPDIR} \
--module=${APPMODULE}:${APPVAL} \
--master \
--pidfile=/tmp/uwsgi_master.pid \
--socket=0.0.0.0:${UWSGI_PORT} \
--processes=5 \
--uid=1000 --gid=2000 \
--harakiri=20 \
--limit-as=128 \
--max-requests=5000 \
--vacuum \
--home=/${APPENV}/${APPDIR} "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment