DEV Community

Use same Dockerfile for Dev & Production

Segun Olaiya on February 08, 2024

In many projects that are containerized, especially in cases where development is also done locally with docker-compose, teams often have two Docke...
Collapse
 
managedkaos profile image
Michael

Thanks for sharing this! I knew about docker stages but not how to use them with the target switch. Nice. 😎

Collapse
 
boldbigflank profile image
♫Alex Swan

This was really helpful! Does this method mean a Docker container without a specified target will be running both? Do prod stage builds have an unused dev server running too, since it builds all the way through?

Collapse
 
kurealnum profile image
Oscar

I'm about a year late for this, but thank you so much! Saved me a few hours.