docker条件组件与环境variables

有没有办法让docker组成做这样的事情:使用组件服务postgreql在容器中,而在开发,但RDS在生产?

如:

if RAILS_ENV == 'production' services: postgres: image: postgres webapp: build: . else webapp: build: . enviromenet: DATABASE_URL: database.url.rds.aws fi