forked from sachinruk/deepschool.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_script.py
More file actions
25 lines (22 loc) · 769 Bytes
/
build_script.py
File metadata and controls
25 lines (22 loc) · 769 Bytes
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
import os
import sys
import subprocess
from subprocess import call
print('Build process started')
out = subprocess.check_output("git diff --name-only HEAD~1 HEAD".split())
out = out.decode('ascii').split('\n')[:-1]
dockerfiles = [files for files in out if "Dockerfile" in files]
def call_cmd(cmd):
ret_code = call(cmd.split())
if ret_code != 0:
print("The following command failed: " + cmd)
sys.exit(ret_code)
TAG = str(sys.argv[1])
if len(dockerfiles)>0:
tagged_version = "sachinruk/deepschoolio:" + TAG
call_cmd("docker build -t sachinruk/deepschoolio .")
call_cmd("docker tag sachinruk/deepschoolio " + tagged_version)
call_cmd("docker push sachinruk/deepschoolio")
print("="*50)
print(" built!")
print("="*50)