Skip to content

Commit

Permalink
feat: update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
varrcan committed Jul 31, 2023
1 parent 3ad6e38 commit 5f542b7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 67 deletions.
84 changes: 38 additions & 46 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,46 @@ LABEL maintainer="dl@varme.pw"

ENV TZ=Europe/Moscow

ARG COMPOSER_VERSION="2.5.8"
ARG UID=1000
ARG GID=1000

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

ARG COMPOSER_VERSION="2.5.4"

RUN set -ex && \
apt-get update && apt-get install -y \
software-properties-common \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libgmp-dev \
libwebp-dev \
libxml2-dev \
zlib1g-dev \
libncurses5-dev \
libldb-dev \
libldap2-dev \
libicu-dev \
libmemcached-dev \
libcurl4-openssl-dev \
libssl-dev \
libsqlite3-dev \
libzip-dev \
libonig-dev \
curl \
ssmtp \
wget \
git \
nano \
zip \
mariadb-client \
&& rm -rf /var/lib/apt/lists/*

RUN pecl install xdebug-3.1.1 \
&& pecl install memcached-3.1.5 \
&& pecl install redis \
&& docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
&& docker-php-ext-configure mysqli --with-mysqli=mysqlnd \
&& docker-php-ext-configure opcache --enable-opcache \
&& docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j$(nproc) mysqli pdo_mysql exif pcntl intl gmp bcmath mbstring gd soap zip opcache sockets

RUN wget https://getcomposer.org/download/${COMPOSER_VERSION}/composer.phar -O /usr/local/bin/composer && \
chmod a+rx /usr/local/bin/composer

RUN groupadd --gid 1000 1000 && \
usermod --non-unique --uid 1000 www-data && \
usermod --gid 1000 www-data
RUN set -ex && apt-get update && apt-get install -y ssmtp wget git nano

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/

RUN IPE_GD_WITHOUTAVIF=1 IPE_ICU_EN_ONLY=1 IPE_KEEP_SYSPKG_CACHE=1 install-php-extensions \
bcmath \
exif \
gd \
gmp \
imagick \
intl \
ldap \
mysqli \
opcache \
pcntl \
pdo_mysql \
pdo_pgsql \
pgsql \
soap \
sockets \
xdebug \
zip

RUN IPE_ICU_EN_ONLY=1 IPE_DONT_ENABLE=1 install-php-extensions \
memcache \
memcached \
redis \
xhprof

RUN install-php-extensions @composer-${COMPOSER_VERSION}

RUN groupadd --gid ${GID} ${GID} && \
usermod --non-unique --uid ${UID} www-data && \
usermod --gid ${GID} www-data

RUN mkdir /var/www/.composer && \
mkdir /var/www/.ssh
Expand Down
21 changes: 0 additions & 21 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,5 @@ if [ "$PHP_MODULES" != "" ]; then
done
fi

# Set memcached session save handle
if [ -n "$MEMCACHED" ]; then
if [ -f "$PHP_INI_DIR"/conf.d/20-memcached.ini ]; then
rm "$PHP_INI_DIR"/conf.d/20-memcached.ini
fi

if [ ! -f "$PHP_INI_DIR"/conf.d/docker-php-ext-memcached.ini ]; then docker-php-ext-enable memcached >/dev/null; fi

IFSO=$IFS
IFS=' ' read -ra BACKENDS <<<"${MEMCACHED}"
for BACKEND in "${BACKENDS[@]}"; do
SAVE_PATH="${SAVE_PATH}${BACKEND}?${MEMCACHED_CONFIG:-persistent=1&timeout=5&retry_interval=30},"
done
IFS=$IFSO

cat <<EOF >>"$PHP_INI_DIR"/conf.d/20-memcached.ini
session.save_handler = memcached
session.save_path = "${SAVE_PATH}"
EOF
fi

# Run
exec "$@"

0 comments on commit 5f542b7

Please sign in to comment.