Hacker News new | ask | show | jobs
by mmarx 3505 days ago
> I agree with most of the points here, but some stuff is misleading. For example the "you have to rebuild after everything that code change" is ridiculous. Just use "COPY SRC/ /app" In your dockerfile, and in dev mount SRC/ as a volume over /app. There, hot reloading sorted for development.

The article _specifically_ refers to production environments, and, by extension, staging servers:

“Good practices dictate that you don’t mount your source code directory in the docker container in production. Which means you also have to rebuild the image on test/staging server every time you make a single line of code change.”

Then it also states in the “logging” section that, contrary to the development environment “On production, since your source code directory isn’t mounted in container […];” so they clearly _are_ mounting the source code in the development containers.

2 comments

Yes, you have to rebuild your image to deploy a new version. But are you really changing code in production on the fly? This seems dangerous.

Also something that can technically be done with Docker, just it's really not a good idea (and that has nothing to do with Docker).

Oh right, sorry, I thought it was obvious that you have to 'rebuild' the image when a code changes. But if you have a "COPY src/ /app" as the last command in your dockerfile then that's not an expensive operation as all the previous ones are cached.

Unless you change your system packages or add a new line to your requirements.txt, in which case the cache would be invalidated and the build takes longer.

But... it's done by your CI server anyway, so...