-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2,512 changed files
with
31,173 additions
and
7,680 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/test/Dockerfile | ||
/test/vendor/ | ||
/test/.bundle/ | ||
/test/*.test | ||
/test/docker.test.*.tar | ||
/BLACKLIST | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ubuntu-14.04 | ||
ubuntu-16.04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env/python | ||
|
||
from jinja2 import Environment, FileSystemLoader | ||
from datetime import datetime | ||
import os | ||
import argparse | ||
|
||
PATH = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
templateHeader = '{% extends "Dockerfile/layout.jinja2" %}\n{% block content %}' | ||
templateFooter = '{% endblock %}' | ||
|
||
def get_current_date(): | ||
import datetime | ||
return datetime.date.today().strftime("%d.%m.%Y") | ||
|
||
def processDockerfile(inputFile, template): | ||
outputFile = os.path.splitext(inputFile) | ||
outputFile = os.path.join(os.path.dirname(outputFile[0]),os.path.basename(outputFile[0])) | ||
|
||
dockerImage = os.path.basename(os.path.dirname(os.path.dirname(outputFile))) | ||
dockerTag = os.path.basename(os.path.dirname(outputFile)) | ||
|
||
context = { | ||
'Dockerfile': { | ||
'image': dockerImage, | ||
'tag': dockerTag | ||
} | ||
} | ||
|
||
print "* Processing Dockerfile for " + dockerImage + ":" + dockerTag | ||
|
||
with open(inputFile, 'r') as fileInput: | ||
templateContent = fileInput.read() | ||
|
||
templateContent = templateHeader + templateContent + templateFooter | ||
|
||
renderedContent = template.from_string(templateContent).render(context) | ||
renderedContent = renderedContent.lstrip() | ||
|
||
with open(outputFile, 'w') as fileOutput: | ||
fileOutput.write(renderedContent) | ||
|
||
|
||
|
||
def main(args): | ||
templatePath = os.path.abspath(args.template) | ||
dockerfilePath = os.path.abspath(args.dockerfile) | ||
|
||
template = Environment( | ||
autoescape=False, | ||
loader=FileSystemLoader([templatePath]), | ||
trim_blocks=False | ||
) | ||
|
||
for root, dirs, files in os.walk(dockerfilePath): | ||
for file in files: | ||
if file.endswith("Dockerfile.jinja2"): | ||
processDockerfile(os.path.join(root, file), template) | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('-t','--template' ,help='',type=str) | ||
parser.add_argument('-d','--dockerfile' ,help='',type=str) | ||
args = parser.parse_args() | ||
main(args) |
Oops, something went wrong.