How to use environment variables in docker-compose in production?

How exactly do we specify the environment variable for docker-compose in the production environment?

For example, below is a snippet of how I have specified my env variables in my current docker-compose file of the development environment:

        - REDIS_HOST=redis
        - REDIS_PORT=6379
        - PGUSER=postgres
        - PGHOST=postgres
        - PGDATABASE=postgres
        - PGPASSWORD=postgres_password
        - PGPORT=5432

But I cannot do the same for the production environment as the code would be pushed on GitHub and it would expose the environment variables.

So how exactly do we solve this problem out?

Source: Docker Questions