From d1c71e6714ddc48bee1546d868c644e8a05c07d1 Mon Sep 17 00:00:00 2001 From: Chris Fidao Date: Thu, 9 Nov 2017 07:53:48 -0600 Subject: [PATCH] creating user vessel and changing their UID via ENTRYPOINT to help permissions/HOME directory issues when running tinker and other commands --- docker-files/docker/app/Dockerfile | 1 + docker-files/docker/app/start-container | 3 +++ docker-files/vessel | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docker-files/docker/app/Dockerfile b/docker-files/docker/app/Dockerfile index a23c2b3..889b3c5 100644 --- a/docker-files/docker/app/Dockerfile +++ b/docker-files/docker/app/Dockerfile @@ -2,6 +2,7 @@ FROM ubuntu:16.04 LABEL maintainer="Chris Fidao" +RUN useradd -ms /bin/bash -u 1337 vessel WORKDIR /var/www/html ENV GOSU_VERSION 1.7 diff --git a/docker-files/docker/app/start-container b/docker-files/docker/app/start-container index f1608bc..5726eee 100644 --- a/docker-files/docker/app/start-container +++ b/docker-files/docker/app/start-container @@ -6,6 +6,9 @@ sed -i "s/xdebug\.remote_host\=.*/xdebug\.remote_host\=$XDEBUG_HOST/g" /etc/php/ # Run PHP-FPM as current user if [ ! -z "$WWWUSER" ]; then sed -i "s/user\ \=.*/user\ \= $WWWUSER/g" /etc/php/7.1/fpm/pool.d/www.conf + + # Set UID of user "vessel" + usermod -u $WWWUSER vessel fi # Ensure /.composer exists and is writable diff --git a/docker-files/vessel b/docker-files/vessel index eb05baa..f602e4a 100755 --- a/docker-files/vessel +++ b/docker-files/vessel @@ -116,7 +116,7 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then $COMPOSE exec \ - -u $WWWUSER \ + -u vessel \ app \ php artisan "$@" else @@ -131,7 +131,7 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then $COMPOSE exec \ - -u $WWWUSER \ + -u vessel \ app \ composer "$@" else @@ -146,7 +146,7 @@ if [ $# -gt 0 ]; then shift 1 if [ "$EXEC" == "yes" ]; then $COMPOSE exec \ - -u $WWWUSER \ + -u vessel \ app \ ./vendor/bin/phpunit "$@" else