Add a new tool for parsing build packs and make sure reparsedockerfile writes it out as well
This commit is contained in:
parent
4eedd54b66
commit
7349d9d4cf
2 changed files with 22 additions and 0 deletions
19
tools/parsebuildpack.py
Normal file
19
tools/parsebuildpack.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
from app import userfiles as user_files
|
||||||
|
|
||||||
|
import workers.dockerfilebuild
|
||||||
|
import requests
|
||||||
|
|
||||||
|
w = workers.dockerfilebuild.DockerfileBuildWorker(100, None)
|
||||||
|
|
||||||
|
resource_key = '5c0a985c-405d-4161-b0ac-603c3757b5f9'
|
||||||
|
resource_url = user_files.get_file_url(resource_key, requires_cors=False)
|
||||||
|
print resource_url
|
||||||
|
|
||||||
|
docker_resource = requests.get(resource_url, stream=True)
|
||||||
|
c_type = docker_resource.headers['content-type']
|
||||||
|
|
||||||
|
if ';' in c_type:
|
||||||
|
c_type = c_type.split(';')[0]
|
||||||
|
|
||||||
|
build_dir = w._mime_processors[c_type](docker_resource)
|
||||||
|
print build_dir
|
|
@ -21,3 +21,6 @@ if image_and_tag_tuple is None or image_and_tag_tuple[0] is None:
|
||||||
raise Exception('Missing FROM command in Dockerfile')
|
raise Exception('Missing FROM command in Dockerfile')
|
||||||
|
|
||||||
print serialize_dockerfile(parsed_dockerfile)
|
print serialize_dockerfile(parsed_dockerfile)
|
||||||
|
|
||||||
|
with open('Dockerfile.test.out', 'w') as dockerfileobj:
|
||||||
|
dockerfileobj.write(serialize_dockerfile(parsed_dockerfile))
|
||||||
|
|
Reference in a new issue