-
Notifications
You must be signed in to change notification settings - Fork 1
/
push.py
executable file
·42 lines (38 loc) · 1.21 KB
/
push.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
# vim:ts=4:sts=4:sw=4:expandtab
import os
import re
import subprocess
import traceback
IMAGES_SPEC='IMAGES'
REPOSITORIES_SPEC='REPOSITORIES'
PROJECT_PATH=os.path.dirname(__file__)
IMAGES_PATH=os.path.join(PROJECT_PATH, IMAGES_SPEC)
REPOSITORIES_PATH=os.path.join(PROJECT_PATH, REPOSITORIES_SPEC)
DFILE='Dockerfile'
TEMPTAG='kolejkatemp'
repositories=[]
with open(REPOSITORIES_PATH) as repositories_file:
for line in repositories_file.readlines():
line = line.strip()
if line.startswith('#'):
continue
repositories.append(line)
with open(IMAGES_PATH) as images_file:
for line in images_file.readlines():
line = line.strip()
if line.startswith('#'):
continue
m = re.match(r'([a-z]+):([a-z.0-9]+)', line)
if m:
repository = m.group(1)
tag = m.group(2)
for repo in repositories:
try:
if repo == TEMPTAG:
continue
pub_tag = repo + '/'+repository+':'+tag
subprocess.run(['docker', 'push', pub_tag])
except:
traceback.print_exc()
pass