Gitlab CI dealing with credentials
GitLab can automatically dockerize applications using the appropriate CI configuration. However, for obvious security reasons, it is bad practice to include credentials in a git repository. Consequently, the CI pipeline is by default not in a position to include credentials in the dockerized application, which most likely prevents the latter from running as intended.
To solve this, the content of sensitive files can be saved as a CI variable, which becomes accessible as an environment variable by the gitlab-runner. This option can be found under:
project settings > CI/CD > variables
Here is an example command that retrieves the content of a secret file and save it as secrets.js:
- cp ${SECRETS} ./secrets.js