@@ -25,10 +25,16 @@ def parse_args():
2525 return user , repo , branch , app
2626
2727
28+ def recursive_chown (path , uid , guid ):
29+ os .chown (os .path .join (path ), uid , guid )
30+ for root , dirs , files in os .walk (path ):
31+ for d in dirs :
32+ os .chown (os .path .join (root , d ), uid , guid )
33+ for f in files :
34+ os .chown (os .path .join (root , f ), uid , guid )
35+
36+
2837DOCKERFILE_SHIM = """FROM deis/slugrunner
29- RUN mkdir -p /app
30- WORKDIR /app
31- ENTRYPOINT ["/runner/init"]
3238ADD slug.tgz /app
3339"""
3440
@@ -73,7 +79,13 @@ if __name__ == '__main__':
7379 config_env = " " .join ([ "-e {}='{}'" .format (* kv ) for kv in json .loads (r .json ().get ('values' , '{}' )).items ()])
7480 # some applications do not have a Procfile, so only check for a Dockerfile
7581 if not os .path .exists (dockerfile ):
82+ # fix permissions
83+ slug_uid = 2000
84+ slug_guid = 2000
85+ for path in (cache_dir , temp_dir ):
86+ recursive_chown (path , slug_uid , slug_guid )
7687 if os .path .exists ('/buildpacks' ):
88+ recursive_chown ('/buildpacks' , slug_uid , slug_guid )
7789 build_cmd = "docker run -i -a stdin {config_env} -v {temp_dir}:/tmp/app -v {cache_dir}:/tmp/cache:rw -v /buildpacks:/tmp/buildpacks deis/slugbuilder" .format (** locals ())
7890 else :
7991 build_cmd = "docker run -i -a stdin {config_env} -v {temp_dir}:/tmp/app -v {cache_dir}:/tmp/cache:rw deis/slugbuilder" .format (** locals ())
0 commit comments