Pass env file to dev image?

I don’t see an obvious way to pass environment variables to the dev image, maybe I am missing something? If no such mechanism exists, would Discourse be open to a PR providing the option in the boot_dev script?

Something like:

ENV_ARGS=""

while [ "${#@}" -ne "0" ]; do
    case "$1" in
        # redacted for brevity
        -i | --init)
            initialize="initialize"
            ;;
        -e | --env)
            if [ -z "$2" ]; then
                show_help
                exit 0
            else  
                ENV_ARGS="--env-file=$2"
                break
            fi
            ;;
        # further redacted for brevity

docker run -d -p 1080:1080 -p 3000:3000 -v "$DATA_DIR:/shared/postgres_data:delegated" -v "$SOURCE_DIR:/src:delegated" $ENV_ARGS --hostname=discourse --name=discourse_dev --restart=always discourse/discourse_dev:release /sbin/boot
3 Likes

Sure, I have not had to do this in the past so it makes sense it is missing. Feel free to add a PR for improving boot_dev, your idea seems pretty spot on, --env-file can be a good first move though probably worth supporting --env like docker uses as well.

2 Likes

Finally was able to turn back to this:

https://github.com/discourse/discourse/pull/6212

3 Likes