pr13 image without composer and yarn

This commit is contained in:
Robin 2022-06-04 21:01:13 +02:00
parent 99cffc8dc7
commit b504731716
3 changed files with 7 additions and 50 deletions

View File

@ -3,7 +3,7 @@ version: '2.4'
services: services:
nginx: nginx:
image: namelessmc/nginx:v2-pr12 image: namelessmc/nginx:v2-pr13
ports: ['8080:8080'] ports: ['8080:8080']
volumes: volumes:
- type: bind # same as php container - type: bind # same as php container
@ -25,14 +25,14 @@ services:
# restart: always # restart: always
php: php:
image: namelessmc/php:v2-pr12 image: namelessmc/php:v2-pr13
volumes: volumes:
- type: bind # same as web container - type: bind # same as web container
source: ./web source: ./web
target: /data target: /data
- target: /tmp - target: /tmp
tmpfs: tmpfs:
size: 100M size: 25M
type: tmpfs type: tmpfs
depends_on: [db] depends_on: [db]
user: '1000' # change this user: '1000' # change this

View File

@ -1,13 +1,8 @@
ARG PHP_VERSION=8.1 FROM php:8.1-fpm-bullseye
FROM php:${PHP_VERSION}-fpm-bullseye
RUN apt-get update && \
apt-get install --no-install-recommends -y yarnpkg && \
rm -rf /var/lib/apt/lists/*
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions && \ RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions @composer gd pdo_mysql mysqli zip exif install-php-extensions gd pdo_mysql mysqli zip exif
# php-fpm loads configuration in alphabetical order so prefix with zz- # php-fpm loads configuration in alphabetical order so prefix with zz-
RUN { \ RUN { \
@ -25,9 +20,6 @@ RUN ln -s /tmp/additional-php-fpm-settings.conf /usr/local/etc/php-fpm.d/zz-name
ADD entrypoint.sh / ADD entrypoint.sh /
ARG VERSION=v2
ENV VERSION=${VERSION}
# Used by website to know if it runs using our docker images for statistics # Used by website to know if it runs using our docker images for statistics
ENV NAMELESSMC_METRICS_DOCKER=true ENV NAMELESSMC_METRICS_DOCKER=true

View File

@ -9,49 +9,16 @@ fi
if [ -n "$(ls -A /data 2>/dev/null)" ] if [ -n "$(ls -A /data 2>/dev/null)" ]
then then
echo "Data directory contains files, not downloading NamelessMC" echo "Data directory contains files, not downloading NamelessMC"
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..."
composer install --no-progress --no-interaction
fi
if [ -n "$NAMELESS_ALWAYS_INSTALL_DEPENDENCIES" ]
then
echo "NAMELESS_ALWAYS_INSTALL_DEPENDENCIES set, running composer and yarn..."
composer install --no-progress --no-interaction
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
mkdir -p /data mkdir -p /data
cd /tmp curl -L "https://github.com/NamelessMC/Nameless/releases/download/v2.0.0-pr13/nameless-deps-dist.tar.xz" | tar --xz --extract --no-same-owner --no-same-permissions --touch --directory=/data --file -
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/* # must not delete /tmp directory itself!
cd /data cd /data
composer install --no-progress --no-interaction
yarnpkg
# remove some unnecessary files (dotfiles in the root directory are not copied in the first place) # 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 \ uploads/placeholder.txt
CONTRIBUTORS.md \
docker-compose.yaml \
Dockerfile \
nginx.example \
README.md \
web.config.example \
uploads/placeholder.txt \
LICENSE.txt \
SECURITY.md \
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 chmod -R ugo-x,u+rwX,go-rw . # Files 600 directories 700
set +x set +x
echo "Done!" echo "Done!"
@ -64,8 +31,6 @@ then
elif [ ! -f scripts/cli_install.php ]; then elif [ ! -f scripts/cli_install.php ]; then
echo "CLI install script doesn't exist, not running installer." echo "CLI install script doesn't exist, not running installer."
else else
echo "Going to run installer, first waiting 10 seconds for the database to start"
sleep 10
echo "Running installer..." echo "Running installer..."
php -f scripts/cli_install.php -- --iSwearIKnowWhatImDoing php -f scripts/cli_install.php -- --iSwearIKnowWhatImDoing
fi fi