Problem
Let say your application has these environments (development, staging, sandbox and production) as the option to run with different configuration depends on current environment.
And you also want to deploy them using docker and maintain the ability to use environment variable like NODE_ENV, RAILS_ENV etc.
Solution
Create script for docker build and modify Dockerfile to accept environment variable
Code
- create_docker_image
- Dockerfile
How to run
$ chmod +x create_docker_image
$ ./create_docker_image sandbox