docker Dockerfile if else condition with external arguments
So if the user pass the proper build argument, the docker build command will create an image of app for production. If not, it will create an image of the app with dev Node.js packages. Using docker-compose, you can inherit environment variables in docker-compose.yml and subsequently any Dockerfile(s) called by docker-compose to build images. This Read Post
