.env environment variables as build flags

Is is possible to include environment variables to be included as build flags from another file? E.g. similar to using docker-compose with a .env file to include environment variables such as encrypted keys and passwords etc?

How about extra_script?