Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion rootfs/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ def download_file(tar_path):
with tarfile.open("apptar", "r:gz") as tar:
tar.extractall("/app/")
log("extracting tar file complete")
buildargs = json.loads(os.getenv('DOCKER_BUILD_ARGS', '{}'))
# inject docker build args into the Dockerfile so we get around Dockerfiles that don't have things
# like PORT defined.
with open("/app/Dockerfile", "a") as dockerfile:
# ensure we are on a new line
dockerfile.write("\n")
for envvar in buildargs:
dockerfile.write("ARG {}\n".format(envvar))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the with block can be limited to float(client.version()['ApiVersion']) < 1.13 because the error was changed to a warning in moby/moby#26249 which is part of the 1.13.0 milestone (unless you also want to suppress the warning).

client = docker.Client(version='auto')
if registryLocation != "on-cluster":
registry = os.getenv('DEIS_REGISTRY_HOSTNAME', 'https://index.docker.io/v1/')
Expand All @@ -112,7 +120,7 @@ def download_file(tar_path):
rm=True,
pull=True,
path='/app',
buildargs=json.loads(os.getenv('DOCKER_BUILD_ARGS', '{}')))
buildargs=buildargs)
log_output(stream, True)
print("Pushing to registry")
stream = client.push(registry+'/'+imageName, tag=imageTag, stream=True)
Expand Down