Using an appropriate base image (debian for dev, alpine for production).
Seems to me like this is a good way to introduce subtle differences between dev and prod.
I'd just use the same base images for everything. Consistency is king.
Don't use Phusion base images. If you need ssh and logrotate and etc, use lxd or a vm.
Or you can use alpine for dev if you are not concerned about debugging too much.
I would say it boils down to use cases and priorities.
But there are simpler ways to build dev images using build stages... I maintain two for my own use, one for web dev and another for ML/back-end stuff:
- https://github.com/rcarmo/ubuntu-python (because musl doesn’t play well with some binary dependencies)
I also tend to rely on uwsgi or sanic rather than gunicorn (which feels a bit dated to me) but those boil down to personal preference.
COPY src/requirements.txt ./
RUN pip install -r requirements.txt
`-e` in a requirements.txt is always a bit of a hack. If you really have to do it, it's highly recommended to pin it to a particular sha1 or tag. But I guess my bias is from spending a lot of time and effort trying to get python projects to be as close as possible to reproducible.
When I ran into problems configuring uwsgi it was painful. This was a few years ago so maybe things have gotten better