How to properly manage mupltiple environmental variables with Gitlab CI and Docker Swarm? In our project we are using Docker and we have multiple services with a pile of environmental variables (mostly credentials to various dbs, mail, samba, 30+ entries in total). It all worked well with docker_compose.yml and docker-compose up -d --build. The advantage of this method was an extensive usage of env files. For example, I had mupltiple env files and I could use them in docker-compose.yml:

env_file:
  - ./envs/common.env
  - ./envs/mail.env
  - ./envs/mysql.env


We set up a Gitlab CI and are planning to use Docker Swarm, so no more manual creation of production env files, use CI/CD. And the primary way in Gitlab is to create variables one by one.  We could create file type variable and put the contents of env file in it, but it will be hard to manage those inner-variables. 

So how do I have to work with env vars now? 


Create a ton of variables in Gitlab UI and aggregate them in env files?
Use file type variables?
Pass them to services in docker-compose.yml file like this:

environment:


VAR1
VAR2
...
VAR20



Or should we also use Docker secrets or some configuration management tool?
There is stages in gitlab ci and on 'docker build' stage I don't need ALL env variables. Usually its only a REACT_APP_SERVER_URI variable.
Later I use env file in compose.yml like you are. 

env_file:
  - ./envs/common.env