Run yarn after download and add option to force

This commit is contained in:
Robin 2022-05-09 21:32:11 +02:00
parent fc9f5b7b09
commit e7864d9a0c
2 changed files with 17 additions and 6 deletions

View File

@ -46,6 +46,7 @@ ENV PHP_PM="ondemand" \
RUN mkdir /data && \ RUN mkdir /data && \
chown 33:33 /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 # The www-data user has uid 33 on Debian/Ubuntu which is what most people are used to
USER 33 USER 33

View File

@ -12,10 +12,19 @@ then
if [ -n "$NAMELESS_COMPOSER_INSTALL" ] if [ -n "$NAMELESS_COMPOSER_INSTALL" ]
then then
echo "WARNING: NAMELESS_COMPOSER_INSTALL is deprecated, use NAMELESS_ALWAYS_INSTALL_DEPENDENCIES instead."
echo "NAMELESS_COMPOSER_INSTALL set, running composer install..." echo "NAMELESS_COMPOSER_INSTALL set, running composer install..."
cd /data
composer install composer install
fi 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 else
echo "Data directory is empty, downloading NamelessMC..." echo "Data directory is empty, downloading NamelessMC..."
set -x set -x
@ -24,9 +33,11 @@ else
curl -Lo "nameless.tar.gz" "https://github.com/NamelessMC/Nameless/archive/${VERSION}.tar.gz" curl -Lo "nameless.tar.gz" "https://github.com/NamelessMC/Nameless/archive/${VERSION}.tar.gz"
tar -xf "nameless.tar.gz" tar -xf "nameless.tar.gz"
mv Nameless-*/* "/data" mv Nameless-*/* "/data"
rm -rf /tmp/* rm -rf /tmp/* # must not delete /tmp directory itself!
# remove some unnecessary files (dotfiles in the root directory are not copied in the first place)
cd /data cd /data
composer install
yarnpkg
# remove some unnecessary files (dotfiles in the root directory are not copied in the first place)
rm -rf \ rm -rf \
cache/.htaccess \ cache/.htaccess \
changelog.txt \ changelog.txt \
@ -39,8 +50,8 @@ else
uploads/placeholder.txt \ uploads/placeholder.txt \
LICENSE.txt \ LICENSE.txt \
SECURITY.md \ SECURITY.md \
phpstan.neon phpstan.neon \
composer install node_modules # generated by yarnpkg, but assets are copied to vendor directory
chmod -R ugo-x,u+rwX,go-rw . # Files 600 directories 700 chmod -R ugo-x,u+rwX,go-rw . # Files 600 directories 700
set +x set +x
echo "Done!" echo "Done!"
@ -48,7 +59,6 @@ fi
if [ -n "$NAMELESS_AUTO_INSTALL" ] if [ -n "$NAMELESS_AUTO_INSTALL" ]
then then
cd /data
if [ -f core/config.php ]; then if [ -f core/config.php ]; then
echo "core/config.php exists, not running installer." echo "core/config.php exists, not running installer."
elif [ ! -f scripts/cli_install.php ]; then elif [ ! -f scripts/cli_install.php ]; then