I am unsure where to use the $PORT environment variable in my
Dockerfile for a container app
When deploying a container app on Heroku, we require that
Dockerfiles be configured to intake the randomly assigned port on a dyno - exposed as the
$PORT environmental variable.
Even though Docker allows for the usage of
EXPOSE to specify which port for an image to use, Heroku ignores those commands and goes by the port assigned to a dyno.
For example, instead of this:
PORT=8080 EXPOSE $PORT CMD gunicorn --bind 0.0.0.0:$PORT wsgi
We ask that you do something like this:
CMD gunicorn --bind 0.0.0.0:$PORT wsgi