Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
refs #67
Browse files Browse the repository at this point in the history
* revert changes corresponding the entrypoint-file
* change ownership of created files with php
  • Loading branch information
Bastian Rang committed Oct 11, 2017
1 parent 4eb234f commit caecbdc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
9 changes: 9 additions & 0 deletions app/File/FileWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ class FileWriter {
public function put(string $path, string $content) {
if( !file_put_contents($path, $content) && strlen($content) !== 0 )
throw new SaveFailedException($path, 100);

/**
* Set user/group corresponding to executing user
*/
if ( !empty($_ENV['USER_ID']) )
chown($path, getenv('USER_ID'));

if ( !empty($_ENV['GROUP_ID']) )
chgrp($path, getenv('GROUP_ID'));
}

/**
Expand Down
14 changes: 5 additions & 9 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
#!/bin/sh

USER="root"
if [ ! -z "$GROUP_ID" ] && [ ! -z "$USER_ID" ] ; then
deluser rancherize > /dev/null 2>&1
addgroup -g $GROUP_ID rancherize
adduser -u $USER_ID -G rancherize -D -s /bin/sh rancherize
USER="rancherize"
if [ "$1" = "sh" ] ; then
shift 1
fi

if type "$1" > /dev/null ; then
su-exec "$USER" $*
if type "$1" >/dev/null ; then
exec $*
exit $?
fi

su-exec "$USER" php /opt/rancherize/rancherize $@
exec php /opt/rancherize/rancherize $@

0 comments on commit caecbdc

Please sign in to comment.