Move to alpine, more streamlined php extension installation

This commit is contained in:
Robin 2021-11-22 15:53:21 +01:00
parent 17b290bb3c
commit 7151ceadc3
3 changed files with 18 additions and 24 deletions

View File

@ -2,13 +2,10 @@
# Before running this, you need to install binfmt_misc support and create a builder:
# docker run --privileged --rm tonistiigi/binfmt --install all
# export DOCKER_CLI_EXPERIMENTAL=enabled
# docker buildx create --use --name mybuilder
# https://github.com/docker/buildx
set -e
export DOCKER_CLI_EXPERIMENTAL=enabled
docker buildx build \
-t namelessmc/nginx:v2-pr7 \
-t namelessmc/nginx:v2-pr8 \

View File

@ -1,24 +1,24 @@
ARG PHP_VERSION=7.4
FROM php:${PHP_VERSION}-fpm
FROM php:${PHP_VERSION}-fpm-alpine
RUN BUILD_DEPS="libmcrypt-dev libldap2-dev" && \
RUNTIME_DEPS="libjpeg62-turbo-dev libfreetype6-dev libpng-dev libfreetype6-dev libzip-dev curl tar sendmail" && \
apt-get update && \
apt-get install -y --no-install-recommends $BUILD_DEPS $RUNTIME_DEPS && \
docker-php-ext-configure gd --with-freetype --with-jpeg && \
docker-php-ext-install -j "$(nproc)" exif gd pdo_mysql mysqli zip && \
apt-get purge -y $BUILD_DEPS && \
apt-get autoremove --purge -y && \
rm -rf /var/lib/{apt,dpkg,cache,log}/ /tmp/* /var/tmp/*
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 gd pdo_mysql mysqli zip exif
# Set www-data user and group to id 33 which is standard in Debian
RUN deluser xfs && \
apk add --no-cache shadow && \
usermod -u 33 www-data && \
groupmod -g 33 www-data && \
apk del shadow
RUN { \
echo "upload_max_filesize = 512M"; \
echo "post_max_size = 512M"; \
echo "max_input_time = 300"; \
echo "max_execution_time = 300"; \
} > /usr/local/etc/php/conf.d/nameless.ini
RUN { \
} > /usr/local/etc/php/conf.d/nameless.ini && \
{ \
echo "[www]"; \
echo "pm.max_children = 32"; \
echo "pm.start_servers = 1"; \
@ -28,7 +28,7 @@ RUN { \
ADD entrypoint.sh /
ARG VERSION=v2.0.0-pr10
ARG VERSION=v2.0.0-pr12
ENV VERSION=${VERSION}
# Used by website to know if it runs using our docker images for statistics
@ -40,4 +40,4 @@ ENV NAMELESS_PATH_HIDE=true
# Enable friendly URLs and hide the option by default, they work fine with the included configuration and there is no reason to turn it off.
ENV NAMELESS_FRIENDLY_URLS=true NAMELESS_FRIENDLY_URLS_HIDE=true
ENTRYPOINT [ "bash", "/entrypoint.sh" ]
ENTRYPOINT [ "sh", "/entrypoint.sh" ]

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
set -e
if [ -n "$(ls -A /data 2>/dev/null)" ]
@ -11,14 +11,11 @@ else
cd /tmp
curl -Lo "nameless.tar.gz" "https://github.com/NamelessMC/Nameless/archive/${VERSION}.tar.gz"
tar -xf "nameless.tar.gz"
mv Nameless-*/{,.[^.]}* "/data"
mv Nameless-*/* "/data"
rm -rf /tmp/*
# remove some unnecessary files
# remove some unnecessary files (dotfiles in the root directory are not copied in the first place)
cd /data
rm -rf \
.gitignore \
.github \
.htaccess \
cache/.htaccess \
changelog.txt \
CONTRIBUTORS.md \