Pyramid Development on Docker

550 views
Skip to first unread message

Stephan Ellis

unread,
Apr 16, 2017, 12:11:14 AM4/16/17
to pylons-...@googlegroups.com
Hi All,

I've been using pyramid for a while, but only recently Docker for my
projects. I really like the idea of using docker for packaging my
apps for deployment, but I like the idea of development inside
containers even better.

I've been using docker-compose to compose my dev environment, for
example containers for couchdb, redis and my pyramid app (created
using the starter template). I can get it to link up those containers
and everything works as expected, great! The only problem is that the
procedure the starter template uses to install my app's package for
development. Here's my Dockerfile:

FROM python:3.4
WORKDIR /opt/testapp
ADD . .
RUN python setup.py develop
ENV PYTHONUNBUFFERED=true
EXPOSE 6543
CMD ["pserve", "--reload", "development.ini"]

The problem is that every time I change anything in the project
directory, the image will rerun setup.py, resulting in slow startup
for obvious reasons. The only reason I would need to run that again
was if I changed the list of required packages in the setup.py file.
I have been struggling to find an elegant solution to this problem.

Can anyone point me in the right direction?

Thanks!
-stephan

Bert JW Regeer

unread,
Apr 16, 2017, 8:16:31 AM4/16/17
to pylons-...@googlegroups.com
I would recommend changing to pip install -e, however you could for example create a base docker image that runs pip install -e, then have a second docker image you use for serving that runs pserve.

This way you do the install step once.

Bert
> --
> You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
> To post to this group, send email to pylons-...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/CAHHSwfP%2B9-1KeU3vf61jbxybE1C%2BZPisN7Y2KZrP%3DmOvMp-Yjw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Stephan Ellis

unread,
Apr 16, 2017, 8:44:23 AM4/16/17
to pylons-...@googlegroups.com
Aha, thanks for the advice. I'll give that a try.

-stephan
> To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/9A2E482C-D602-49A9-BAF9-5A2608C1ACB9%400x58.com.

Stephan Ellis

unread,
Apr 16, 2017, 9:13:49 AM4/16/17
to pylons-...@googlegroups.com
Perfect, thanks again for the advice, Bert. I think I've got
workable set up now.


-stephan
Reply all
Reply to author
Forward
0 new messages