From 28c2f746e62bcd690be767e64460e622991f26b9 Mon Sep 17 00:00:00 2001 From: zhongjin Date: Wed, 7 Jun 2023 09:20:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'Dockerfile'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..22c368c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,72 @@ +FROM php:8.1-apache-bullseye + +ENV OHRM_VERSION 5.3 +ENV OHRM_MD5 82f2739e3f8ce4429b283863689ab5a1 + +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +RUN set -ex; \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libfreetype6-dev \ + libjpeg-dev \ + libpng-dev \ + libzip-dev \ + libldap2-dev \ + libicu-dev \ + unzip \ + ; \ + \ + cd .. && rm -r html; \ + curl -fSL -o orangehrm.zip "https://sourceforge.net/projects/orangehrm/files/stable/${OHRM_VERSION}/orangehrm-${OHRM_VERSION}.zip"; \ + echo "${OHRM_MD5} orangehrm.zip" | md5sum -c -; \ + unzip -q orangehrm.zip "orangehrm-${OHRM_VERSION}/*"; \ + mv orangehrm-$OHRM_VERSION html; \ + rm -rf orangehrm.zip; \ + chown www-data:www-data html; \ + chown -R www-data:www-data html/src/cache html/src/log html/src/config; \ + chmod -R 775 html/src/cache html/src/log html/src/config; \ + \ + docker-php-ext-configure gd --with-freetype --with-jpeg; \ + docker-php-ext-configure ldap \ + --with-libdir=lib/$(uname -m)-linux-gnu/ \ + ; \ + \ + docker-php-ext-install -j "$(nproc)" \ + gd \ + opcache \ + intl \ + pdo_mysql \ + zip \ + ldap \ + ; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { print $3 }' \ + | sort -u \ + | xargs -r dpkg-query -S \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/cache/apt/archives; \ + rm -rf /var/lib/apt/lists/* + +RUN { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=60'; \ + echo 'opcache.fast_shutdown=1'; \ + echo 'opcache.enable_cli=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + if command -v a2enmod; then \ + a2enmod rewrite; \ + fi; + +VOLUME ["/var/www/html"]