Skip to content
Snippets Groups Projects
Commit 2aec8b4d5a4e authored by Carine Dengler's avatar Carine Dengler
Browse files

feat: added script to generate docker images

parent 373352c8fbe1
No related branches found
No related tags found
No related merge requests found
import os
import glob
import sys
TEMPLATE = '''
build_{project}:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{{\\"auths\\":{{\\"$CI_REGISTRY\\":{{\\"username\\":\\"$CI_REGISTRY_USER\\",\\"password\\":\\"$CI_REGISTRY_PASSWORD\\"}}}}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context $CI_PROJECT_DIR/{context}
--dockerfile $CI_PROJECT_DIR/{filepath}
--destination $CI_REGISTRY_IMAGE/{project}
'''
if sys.argv[1]:
TEMPLATE += f" --build-arg {sys.argv[1]}={sys.argv[2]}"
with open('.gitlab-ci.yml', 'w') as f:
for filepath in sorted(glob.glob('library/**/Dockerfile', recursive=True)):
project = '-'.join(filepath.split('/')[1:-1])
context = filepath.replace('/Dockerfile', '')
f.write(TEMPLATE.format(project=project,
context=context,
filepath=filepath))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment