just wondering why gunicorn dockerfile with web2py/anyserver.py is not work 
when use with python:2.7 image
e.g.
*step i took*
cat <<EOF > Dockerfile
FROM python:2.7
RUN apt update && \
 apt install -y unzip wget gunicorn
RUN groupadd -r web2py && \
 useradd -m -r -g web2py web2py
USER web2py
RUN cd /home/web2py/ && \
 wget -c http://web2py.com/examples/static/web2py_src.zip && \
 unzip -o web2py_src.zip && \
 rm -rf /home/web2py/web2py/applications/examples && \
 chmod 755 -R /home/web2py/web2py
EXPOSE 80
CMD cd ~ && python /home/web2py/web2py/anyserver.py -s gunicorn -i 0.0.0.0 
-p 80
EOF
docker build .
docker images
docker run -p 80:80 imageid

*result*
starting gunicorn on 0.0.0.0:80...
Traceback (most recent call last):
  File "/home/web2py/web2py/anyserver.py", line 365, in <module>
    main()
  File "/home/web2py/web2py/anyserver.py", line 362, in main
    options=options)
  File "/home/web2py/web2py/anyserver.py", line 314, in run
    getattr(Servers, servername)(application, (ip, int(port)), 
options=options)
  File "/home/web2py/web2py/anyserver.py", line 137, in gunicorn
    from gunicorn.app.base import Application
ImportError: No module named gunicorn.app.base

but it works well when using ubuntu latest image
*e.g.*
*step i took*
cat <<EOF > Dockerfile
FROM ubuntu:latest
RUN apt update && \
 apt install -y python python-pip python-setuptools unzip vim wget gunicorn 
&& \
 pip install --upgrade pip && \
 pip install virtualenv && \
 virtualenv /home/site && \
 rm -rf /home/site/web2py && \
 cd /home/site/ && \
 rm -f web2py_src.zip && \
 wget -c http://web2py.com/examples/static/web2py_src.zip && \
 unzip -o web2py_src.zip && \
 rm -rf /home/site/web2py/applications/examples && \
 chmod 755 -R /home/site/web2py
EXPOSE 80 
CMD . /home/site/bin/activate && /usr/bin/python 
/home/site/web2py/anyserver.py -s gunicorn -i 0.0.0.0 -p 80
EOF
docker build .
docker images
docker run -p 80:80 imageid

all tested in https://labs.play-with-docker.com

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to