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

View File

@ -1,13 +1,8 @@
ARG PHP_VERSION=8.1
FROM php:${PHP_VERSION}-fpm-bullseye
RUN apt-get update && \
apt-get install --no-install-recommends -y yarnpkg && \
rm -rf /var/lib/apt/lists/*
FROM php:8.1-fpm-bullseye
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 && \
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-
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 /
ARG VERSION=v2
ENV VERSION=${VERSION}
# Used by website to know if it runs using our docker images for statistics
ENV NAMELESSMC_METRICS_DOCKER=true

View File

@ -9,49 +9,16 @@ fi
if [ -n "$(ls -A /data 2>/dev/null)" ]
then
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
echo "Data directory is empty, downloading NamelessMC..."
set -x
mkdir -p /data
cd /tmp
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!
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 -
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)
rm -rf \
cache/.htaccess \
changelog.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
uploads/placeholder.txt
chmod -R ugo-x,u+rwX,go-rw . # Files 600 directories 700
set +x
echo "Done!"
@ -64,8 +31,6 @@ then
elif [ ! -f scripts/cli_install.php ]; then
echo "CLI install script doesn't exist, not running installer."
else
echo "Going to run installer, first waiting 10 seconds for the database to start"
sleep 10
echo "Running installer..."
php -f scripts/cli_install.php -- --iSwearIKnowWhatImDoing
fi