<p><pre><code> Using an appropriate base image (debian for dev, alpine for production).
</code></pre>
No you don't. It's nonsensical to use a "convenient" development environment, and then make the production application work in something more bare-bones/stripped down/different. I've never used Alpine Linux, but even I know there's a LOT of subtle differences between it and Debian. Nontrivial stuff that matters, like C library implementation (GNU libc vs. musl) and init system (systemd vs. sysv init). You don't want that, because it opens up a multiverse full of potential, exclusively bad surprises that you'll be unprepared to debug.
> Using an appropriate base image (debian for dev, alpine for production).<p>Seems to me like this is a good way to introduce subtle differences between dev and prod.<p>I'd just use the same base images for everything. Consistency is king.
One thing that’s missing from the RUN command is ‘-u’, for unbuffered output (essential when using the default loggers).<p>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:<p>- <a href="https://github.com/rcarmo/alpine-python" rel="nofollow">https://github.com/rcarmo/alpine-python</a><p>- <a href="https://github.com/rcarmo/ubuntu-python" rel="nofollow">https://github.com/rcarmo/ubuntu-python</a> (because musl doesn’t play well with some binary dependencies)<p>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.
Just curious, why do you need gunicorn for auto-restarting the server inside a docker container, if you can just restart the container? It's pretty lightweight operation for config changes, imo.
<p><pre><code> COPY src/requirements.txt ./
RUN pip install -r requirements.txt
</code></pre>
This has always confounded me as we always put `-e .` in our requirements.txt. Has this fallen out of favour? It doesn't appear the author's application needs to be installed like most pyramid or click applications do.