From bdfa46b838998a461b786019b3de1b5703074958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Thu, 28 Sep 2023 10:02:06 +0200 Subject: [PATCH] add entry point for dev docker --- docker/scripts/entry-point-dev.sh | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 docker/scripts/entry-point-dev.sh diff --git a/docker/scripts/entry-point-dev.sh b/docker/scripts/entry-point-dev.sh new file mode 100755 index 0000000..0d5fe81 --- /dev/null +++ b/docker/scripts/entry-point-dev.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +echo "Installing Composer packages..." +if [ -f .env ]; then + composer install +else + composer create-project +fi + +echo "Installing Yarn packages..." +(cd public/static && yarn install) + +echo "Migrating DB..." +./rvr db:migrate + +echo "Set runner user based on owner of .env..." +USER_UID=$(stat -c "%u" .env) +USER_GID=$(stat -c "%g" .env) +groupadd --gid $USER_GID rvr +useradd --uid $USER_UID --gid $USER_GID rvr +sed -i -e "s/^user = .*$/user = rvr/g" -e "s/^group = .*$/group = rvr/g" /etc/php/7.4/fpm/pool.d/www.conf + +set +e + +/usr/sbin/php-fpm7.4 -F & +/usr/sbin/nginx -g 'daemon off;' & + +wait -n + +exit $?