Reputation: 1066
In docker hub, there is a container which when launched opens a port of 9000 by default. The port can be overridden by passing an enviorment variable server__port.
I am trying to pass Heroku $PORT value in the dockerfile as shown below:
ENV server__port=$PORT
EXPOSE $PORT
CMD start.sh
When the start.sh executes, I can see a log where server__port is shown as blank.
If I put a random value of '8889' in the server__port environment variable then in the logs I can see 8889 value assigned to server__port.
I tried to use ARG as shown below, and unfortunately got blank value in server__port variable.
ARG PORT
ENV server__port=$PORT
EXPOSE $PORT
CMD start.sh
How do I get Heroku port value and set in the dockerfile?
Upvotes: 1
Views: 688
Reputation: 1066
Figured it out, I had to export the variable as shown below.
The variable would define the port that would be used by the application. The command is
CMD export CONF_listener__port=$PORT && sh ./start.sh && sh ./startServer.sh -Dclearreports.config="$DEFAULT_CONFIG" -Dsetupautoexecution=true
Upvotes: 1