diff --git a/php_fpm/Dockerfile b/php_fpm/Dockerfile index 64bc040..9fae8fb 100644 --- a/php_fpm/Dockerfile +++ b/php_fpm/Dockerfile @@ -46,6 +46,7 @@ ENV PHP_PM="ondemand" \ RUN mkdir /data && \ chown 33:33 /data +WORKDIR /data # The www-data user has uid 33 on Debian/Ubuntu which is what most people are used to USER 33 diff --git a/php_fpm/entrypoint.sh b/php_fpm/entrypoint.sh index baef735..29fcd6e 100644 --- a/php_fpm/entrypoint.sh +++ b/php_fpm/entrypoint.sh @@ -12,10 +12,19 @@ then if [ -n "$NAMELESS_COMPOSER_INSTALL" ] then + echo "WARNING: NAMELESS_COMPOSER_INSTALL is deprecated, use NAMELESS_ALWAYS_INSTALL_DEPENDENCIES instead." echo "NAMELESS_COMPOSER_INSTALL set, running composer install..." - cd /data composer install fi + + if [ -n "$NAMELESS_ALWAYS_INSTALL_DEPENDENCIES" ] + then + echo "NAMELESS_ALWAYS_INSTALL_DEPENDENCIES set, running composer and yarn..." + composer install + yarnpkg + # When running yarnpkg after downloading, the script deletes node_modules. However, doing that here + # would require redownloading all modules at every container start. + fi else echo "Data directory is empty, downloading NamelessMC..." set -x @@ -24,9 +33,11 @@ else curl -Lo "nameless.tar.gz" "https://github.com/NamelessMC/Nameless/archive/${VERSION}.tar.gz" tar -xf "nameless.tar.gz" mv Nameless-*/* "/data" - rm -rf /tmp/* - # remove some unnecessary files (dotfiles in the root directory are not copied in the first place) + rm -rf /tmp/* # must not delete /tmp directory itself! cd /data + composer install + yarnpkg + # remove some unnecessary files (dotfiles in the root directory are not copied in the first place) rm -rf \ cache/.htaccess \ changelog.txt \ @@ -39,8 +50,8 @@ else uploads/placeholder.txt \ LICENSE.txt \ SECURITY.md \ - phpstan.neon - composer install + phpstan.neon \ + node_modules # generated by yarnpkg, but assets are copied to vendor directory chmod -R ugo-x,u+rwX,go-rw . # Files 600 directories 700 set +x echo "Done!" @@ -48,7 +59,6 @@ fi if [ -n "$NAMELESS_AUTO_INSTALL" ] then - cd /data if [ -f core/config.php ]; then echo "core/config.php exists, not running installer." elif [ ! -f scripts/cli_install.php ]; then