I am fairly new to DevOps. I have managed to build myself a CI/DI pipeline for my open source project.
As soon as I check-in some code into GitHub, Travis CI takes over, it builds a fresh docker image of my code, pushes it to DockerHub, then the after_success step within my .travis.yml connects to my VPS via SSH, and runs a script on there which basically does a docker-compose down followed by a docker-compose pull && docker compose up.
All seems to be working correctly. But I have an issue with my docker-compose.yml. Right now as you can see, it has all my environmental variables. Those are considered secret information. How do I hide them from the docker-compose.yml file whilst having everything still working as before?
UPDATE
I went and created myself a variables.env file in the same directory as the docker-compose.yml. Inside the .env file, I put my old variables, for example:
Database__DefaultConnectionString: "Server=database;Port=5432;Database=bejebeje_identity;User Id=postgres;Password=admin;"
But in Travis CI I get the following error:
environment variable name 'Database__DefaultConnectionString: "Server' may not contains whitespace.
/var/www/html/mysite.co.uk/I'll have a.envfile with the JSON where the keys match the environmental variables that my application is expecting? – J86 Mar 29 '19 at 17:57docker-compose upwill need the.envfile in the current working directory. Those variables must match the variables declared in your compose file. – swysocki Mar 29 '19 at 18:44var: valueinstead ofvar=value. – J86 Mar 29 '19 at 20:34