Docker base images for PHP-FPM
This commit is contained in:
@@ -0,0 +1 @@
|
||||
.env
|
||||
@@ -0,0 +1,295 @@
|
||||
FROM php:7.1-fpm
|
||||
|
||||
MAINTAINER Mark Hilton <nerd305@gmail.com>
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
git \
|
||||
libmemcached-dev \
|
||||
libz-dev \
|
||||
libpq-dev \
|
||||
libjpeg-dev \
|
||||
libfreetype6-dev \
|
||||
libssl-dev \
|
||||
libmcrypt-dev
|
||||
|
||||
RUN docker-php-ext-install mcrypt
|
||||
RUN docker-php-ext-install mysqli pdo pdo_mysql
|
||||
|
||||
# install the PHP gd library
|
||||
RUN docker-php-ext-configure gd \
|
||||
--enable-gd-native-ttf \
|
||||
--with-jpeg-dir=/usr/lib \
|
||||
--with-freetype-dir=/usr/include/freetype2 && \
|
||||
docker-php-ext-install gd
|
||||
|
||||
# install the soap extension
|
||||
RUN apt-get update -yqq && \
|
||||
apt-get -y install libxml2-dev && \
|
||||
docker-php-ext-install soap
|
||||
|
||||
# install Php Redis Extension
|
||||
RUN pecl install -o -f redis \
|
||||
&& rm -rf /tmp/pear \
|
||||
&& docker-php-ext-enable redis
|
||||
|
||||
# install the mongodb extension
|
||||
RUN pecl install mongodb && \
|
||||
docker-php-ext-enable mongodb
|
||||
|
||||
# install bcmath, mbstring and zip extensions
|
||||
RUN docker-php-ext-install bcmath && \
|
||||
docker-php-ext-install mbstring && \
|
||||
docker-php-ext-install zip
|
||||
|
||||
# enable Exif PHP extentions requirements
|
||||
RUN docker-php-ext-install exif
|
||||
|
||||
# tokenizer Modifications:
|
||||
RUN docker-php-ext-install tokenizer
|
||||
|
||||
# install intl and requirements
|
||||
RUN apt-get update -yqq && \
|
||||
apt-get install -y zlib1g-dev libicu-dev g++ && \
|
||||
docker-php-ext-configure intl && \
|
||||
docker-php-ext-install intl
|
||||
|
||||
# install the ghostscript extension for PDF editing
|
||||
RUN apt-get update -yqq \
|
||||
&& apt-get install -y \
|
||||
poppler-utils \
|
||||
ghostscript
|
||||
|
||||
# LDAP:
|
||||
RUN apt-get update -yqq && \
|
||||
apt-get install -y libldap2-dev && \
|
||||
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \
|
||||
docker-php-ext-install ldap
|
||||
|
||||
RUN yes "" | pecl install msgpack-beta \
|
||||
&& echo "extension=msgpack.so" > /usr/local/etc/php/conf.d/ext-msgpack.ini
|
||||
|
||||
# compile igbinary extension
|
||||
RUN cd /tmp/ && git clone https://github.com/igbinary/igbinary "php-igbinary" && \
|
||||
cd php-igbinary && \
|
||||
phpize && \
|
||||
./configure && \
|
||||
make && \
|
||||
make install && \
|
||||
make clean && \
|
||||
docker-php-ext-enable igbinary
|
||||
|
||||
# curl extension
|
||||
RUN apt-get install -y curl libcurl4-openssl-dev --no-install-recommends && \
|
||||
docker-php-ext-install curl
|
||||
|
||||
# data structures extension
|
||||
RUN pecl install ds && \
|
||||
docker-php-ext-enable ds
|
||||
|
||||
# imagick
|
||||
RUN apt-get update && apt-get install -y libmagickwand-6.q16-dev --no-install-recommends && \
|
||||
ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/MagickWand-config /usr/bin && \
|
||||
pecl install imagick && \
|
||||
echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini
|
||||
|
||||
# ssh2 module
|
||||
RUN apt-get install -y libssh2-1-dev && \
|
||||
pecl install ssh2-1.0 && \
|
||||
docker-php-ext-enable ssh2
|
||||
|
||||
# php-module: curl dom bz2 gd json mysqli pcntl pdo pdo_mysql phar posix
|
||||
RUN apt-get install -y libxml2-dev libbz2-dev re2c libpng++-dev \
|
||||
libjpeg-dev libvpx-dev zlib1g-dev libgd-dev \
|
||||
libtidy-dev libxslt1-dev libmagic-dev libexif-dev file \
|
||||
sqlite3 libsqlite3-dev libxslt-dev
|
||||
|
||||
RUN export CFLAGS="-I/usr/src/php" && \
|
||||
docker-php-ext-install xmlreader xmlwriter
|
||||
|
||||
RUN docker-php-ext-configure json && \
|
||||
docker-php-ext-configure session && \
|
||||
docker-php-ext-configure ctype && \
|
||||
docker-php-ext-configure tokenizer && \
|
||||
docker-php-ext-configure simplexml && \
|
||||
docker-php-ext-configure dom && \
|
||||
docker-php-ext-configure mbstring && \
|
||||
docker-php-ext-configure zip && \
|
||||
docker-php-ext-configure pdo && \
|
||||
docker-php-ext-configure pdo_sqlite && \
|
||||
docker-php-ext-configure pdo_mysql && \
|
||||
docker-php-ext-configure mysqli && \
|
||||
docker-php-ext-configure iconv && \
|
||||
docker-php-ext-configure xml && \
|
||||
docker-php-ext-configure phar
|
||||
|
||||
RUN docker-php-ext-install \
|
||||
dom \
|
||||
bz2 \
|
||||
json \
|
||||
pcntl \
|
||||
phar \
|
||||
posix \
|
||||
simplexml \
|
||||
soap \
|
||||
tidy \
|
||||
xml \
|
||||
xmlrpc \
|
||||
xsl \
|
||||
calendar \
|
||||
ctype \
|
||||
fileinfo \
|
||||
ftp \
|
||||
sysvmsg \
|
||||
sysvsem \
|
||||
sysvshm
|
||||
|
||||
# install the php memcache & memcached extension
|
||||
RUN set -x \
|
||||
&& apt-get update && apt-get install -y --no-install-recommends unzip libssl-dev libpcre3 libpcre3-dev \
|
||||
&& cd /tmp \
|
||||
&& curl -sSL -o php7.zip https://github.com/websupport-sk/pecl-memcache/archive/php7.zip \
|
||||
&& unzip php7 \
|
||||
&& cd pecl-memcache-php7 \
|
||||
&& /usr/local/bin/phpize \
|
||||
&& ./configure --with-php-config=/usr/local/bin/php-config \
|
||||
&& make \
|
||||
&& make install \
|
||||
&& echo "extension=memcache.so" > /usr/local/etc/php/conf.d/ext-memcache.ini \
|
||||
&& rm -rf /tmp/pecl-memcache-php7 php7.zip
|
||||
|
||||
RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
|
||||
&& mkdir -p memcached \
|
||||
&& tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
|
||||
&& ( \
|
||||
cd memcached \
|
||||
&& phpize \
|
||||
&& ./configure \
|
||||
&& make -j$(nproc) \
|
||||
&& make install \
|
||||
) \
|
||||
&& rm -r memcached \
|
||||
&& rm /tmp/memcached.tar.gz \
|
||||
&& docker-php-ext-enable memcached
|
||||
|
||||
# mhash
|
||||
RUN apt-get install -y libmhash2 libmhash-dev libc-client-dev libkrb5-dev
|
||||
|
||||
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
|
||||
&& docker-php-ext-install imap
|
||||
|
||||
RUN docker-php-ext-configure hash --with-mhash && \
|
||||
docker-php-ext-install hash
|
||||
|
||||
# Opcache
|
||||
RUN docker-php-ext-install opcache
|
||||
|
||||
# install APCu
|
||||
RUN pecl install apcu-5.1.8 && \
|
||||
pecl install apcu_bc-1.0.3 && \
|
||||
docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini && \
|
||||
docker-php-ext-enable apc --ini-name 20-docker-php-ext-apc.ini
|
||||
|
||||
# install MSSQL support
|
||||
# install ODBC driver
|
||||
RUN apt-get update -y && apt-get install -y apt-transport-https locales gnupg
|
||||
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
|
||||
curl https://packages.microsoft.com/config/debian/8/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
|
||||
export DEBIAN_FRONTEND=noninteractive && apt-get update -y && \
|
||||
ACCEPT_EULA=Y apt-get install -y msodbcsql unixodbc-dev
|
||||
RUN set -xe \
|
||||
&& pecl install pdo_sqlsrv \
|
||||
&& docker-php-ext-enable pdo_sqlsrv \
|
||||
&& apt-get purge -y unixodbc-dev && apt-get autoremove -y && apt-get clean
|
||||
|
||||
# set locale to utf-8
|
||||
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
|
||||
locale-gen
|
||||
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
|
||||
|
||||
# geoip - DEPRECIATED: using provided by Nginx container
|
||||
# RUN runtimeRequirements="libgeoip-dev" \
|
||||
# && apt-get update && apt-get install -y ${runtimeRequirements} \
|
||||
# && pecl install geoip-1.1.1 \
|
||||
# && printf "extension=geoip.so\n[geoip]\ngeoip.custom_directory = /usr/share/GeoIP/\n" > /usr/local/etc/php/conf.d/ext-geoip.ini
|
||||
|
||||
# RUN mkdir -p /usr/share/GeoIP && cd /usr/share/GeoIP/ && \
|
||||
# rm -f GeoIP.dat GeoIPv6.dat && \
|
||||
# curl -L -O http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && \
|
||||
# curl -L -O http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz && \
|
||||
# gzip -d * && \
|
||||
# mv GeoLiteCity.dat GeoIPCity.dat
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Final Touches
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
# install helpful libs
|
||||
RUN apt-get -y install libfcgi0ldbl nano cron
|
||||
|
||||
# crontab fix: https://stackoverflow.com/questions/43323754/cannot-make-remove-an-entry-for-the-specified-session-cron
|
||||
RUN sed -i '/session required pam_loginuid.so/c\#session required pam_loginuid.so' /etc/pam.d/cron
|
||||
|
||||
# expose /status for health check & stop access log
|
||||
RUN echo "pm.status_path = /status" >> /usr/local/etc/php/conf.d/zz-docker.conf && \
|
||||
echo "ping.path = /ping" >> /usr/local/etc/php/conf.d/zz-docker.conf && \
|
||||
echo "ping.response = OK" >> /usr/local/etc/php/conf.d/zz-docker.conf && \
|
||||
echo "access.log = /proc/self/fd/1" >> /usr/local/etc/php/conf.d/zz-docker.conf
|
||||
|
||||
# composer
|
||||
# consider removing to a separate container
|
||||
# RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer && chmod +x /usr/local/bin/composer
|
||||
# ENV PATH="$PATH:/root/.composer/vendor/bin"
|
||||
|
||||
# install modman
|
||||
# RUN curl -s -L https://raw.github.com/colinmollenhour/modman/master/modman-installer | bash && \
|
||||
# mv ~/bin/modman /usr/sbin/
|
||||
|
||||
# install NewRelic agent
|
||||
RUN echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | tee /etc/apt/sources.list.d/newrelic.list && \
|
||||
curl https://download.newrelic.com/548C16BF.gpg | apt-key add - && \
|
||||
apt-get -y update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y install newrelic-php5 newrelic-sysmond && \
|
||||
export NR_INSTALL_SILENT=1 && newrelic-install install
|
||||
|
||||
# install blackfire.io profiler
|
||||
# RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
|
||||
# && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
|
||||
# && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
|
||||
# && mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
|
||||
# && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini
|
||||
|
||||
# install SendGrid
|
||||
RUN echo "postfix postfix/mailname string localhost" | debconf-set-selections && \
|
||||
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install postfix libsasl2-modules -y
|
||||
|
||||
# install shared PHP code
|
||||
RUN git clone https://github.com/nrk/predis.git /usr/local/lib/php/predis && \
|
||||
git clone https://github.com/markhilton/redis-http-cache.git /usr/local/lib/php/redis-http-cache
|
||||
|
||||
# Set default work directory
|
||||
ADD scripts/* /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
|
||||
# install aliases
|
||||
RUN echo "" >> ~/.bashrc && \
|
||||
echo "# Load Custom Aliases" >> ~/.bashrc && \
|
||||
echo "source /usr/local/bin/aliases.sh" >> ~/.bashrc && \
|
||||
echo "" >> ~/.bashrc && \
|
||||
sed -i 's/\r//' /usr/local/bin/aliases.sh && \
|
||||
sed -i 's/^#! \/bin\/sh/#! \/bin\/bash/' /usr/local/bin/aliases.sh
|
||||
|
||||
# Clean up
|
||||
RUN apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=5s --timeout=3s \
|
||||
CMD SCRIPT_NAME=/status SCRIPT_FILENAME=/status REQUEST_METHOD=GET cgi-fcgi -bind -connect 127.0.0.1:9000 || exit 1
|
||||
|
||||
EXPOSE 9000
|
||||
WORKDIR /app
|
||||
|
||||
CMD ["php-fpm"]
|
||||
@@ -0,0 +1,22 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
php70:
|
||||
image: crunchgeek/php-fpm:7.0.r1
|
||||
restart: always
|
||||
hostname: php70
|
||||
container_name: php70
|
||||
environment:
|
||||
- ENDPOINT=${ENDPOINT}
|
||||
- FILESYSTEM=${FILESYSTEM}
|
||||
- APPLICATIONS=${APPLICATIONS}
|
||||
- NEWRELIC_LICENSE=${NEWRELIC_LICENSE}
|
||||
- SMTP_LOGIN=${SMTP_LOGIN}
|
||||
- SMTP_PASSWORD=${SMTP_PASSWORD}
|
||||
volumes:
|
||||
- ${APPLICATIONS}:/applications
|
||||
- configurations:/usr/local/etc/sites/
|
||||
|
||||
volumes:
|
||||
configurations:
|
||||
@@ -0,0 +1,144 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Colors used for status updates
|
||||
ESC_SEQ="\x1b["
|
||||
COL_RESET=$ESC_SEQ"39;49;00m"
|
||||
COL_RED=$ESC_SEQ"31;01m"
|
||||
COL_GREEN=$ESC_SEQ"32;01m"
|
||||
COL_YELLOW=$ESC_SEQ"33;01m"
|
||||
COL_BLUE=$ESC_SEQ"34;01m"
|
||||
COL_MAGENTA=$ESC_SEQ"35;01m"
|
||||
COL_CYAN=$ESC_SEQ"36;01m"
|
||||
|
||||
# Detect which `ls` flavor is in use
|
||||
if ls --color > /dev/null 2>&1; then # GNU `ls`
|
||||
colorflag="--color"
|
||||
export LS_COLORS='no=00:fi=00:di=01;31:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
|
||||
else # macOS `ls`
|
||||
colorflag="-G"
|
||||
export LSCOLORS='BxBxhxDxfxhxhxhxhxcxcx'
|
||||
fi
|
||||
|
||||
# List all files colorized in long format
|
||||
#alias l="ls -lF ${colorflag}"
|
||||
### MEGA: I want l and la ti return hisdden files
|
||||
alias l="ls -laF ${colorflag}"
|
||||
|
||||
# List all files colorized in long format, including dot files
|
||||
alias la="ls -laF ${colorflag}"
|
||||
|
||||
# List only directories
|
||||
alias lsd="ls -lF ${colorflag} | grep --color=never '^d'"
|
||||
|
||||
# Always use color output for `ls`
|
||||
alias ls="command ls ${colorflag}"
|
||||
|
||||
# Commonly Used Aliases
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
alias ~="cd ~" # `cd` is probably faster to type though
|
||||
alias -- -="cd -"
|
||||
alias home="cd ~"
|
||||
|
||||
alias h="history"
|
||||
alias j="jobs"
|
||||
alias e='exit'
|
||||
alias c="clear"
|
||||
alias cla="clear && ls -l"
|
||||
alias cll="clear && ls -la"
|
||||
alias cls="clear && ls"
|
||||
alias code="cd /var/www"
|
||||
alias ea="vi ~/aliases"
|
||||
|
||||
# Always enable colored `grep` output
|
||||
# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage.
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
|
||||
alias art="php artisan"
|
||||
alias artisan="php artisan"
|
||||
alias cdump="composer dump-autoload -o"
|
||||
alias composer:dump="composer dump-autoload -o"
|
||||
alias db:reset="php artisan migrate:reset && php artisan migrate --seed"
|
||||
alias dusk="php artisan dusk"
|
||||
alias fresh="php artisan migrate:fresh"
|
||||
alias migrate="php artisan migrate"
|
||||
alias refresh="php artisan migrate:refresh"
|
||||
alias rollback="php artisan migrate:rollback"
|
||||
alias seed="php artisan:seed"
|
||||
alias serve="php artisan serve --quiet &"
|
||||
|
||||
alias phpunit="./vendor/bin/phpunit"
|
||||
alias pu="phpunit"
|
||||
alias puf="phpunit --filter"
|
||||
alias pud='phpunit --debug'
|
||||
|
||||
alias cc='codecept'
|
||||
alias ccb='codecept build'
|
||||
alias ccr='codecept run'
|
||||
alias ccu='codecept run unit'
|
||||
alias ccf='codecept run functional'
|
||||
|
||||
alias g="gulp"
|
||||
alias npm-global="npm list -g --depth 0"
|
||||
alias ra="reload"
|
||||
alias reload="source ~/.aliases && echo \"$COL_GREEN ==> Aliases Reloaded... $COL_RESET \n \""
|
||||
alias run="npm run"
|
||||
alias tree="xtree"
|
||||
|
||||
# Xvfb
|
||||
alias xvfb="Xvfb -ac :0 -screen 0 1024x768x16 &"
|
||||
|
||||
# requires installation of 'https://www.npmjs.com/package/npms-cli'
|
||||
alias npms="npms search"
|
||||
# requires installation of 'https://www.npmjs.com/package/package-menu-cli'
|
||||
alias pm="package-menu"
|
||||
# requires installation of 'https://www.npmjs.com/package/pkg-version-cli'
|
||||
alias pv="package-version"
|
||||
# requires installation of 'https://github.com/sindresorhus/latest-version-cli'
|
||||
alias lv="latest-version"
|
||||
|
||||
# git aliases
|
||||
alias gaa="git add ."
|
||||
alias gd="git --no-pager diff"
|
||||
alias git-revert="git reset --hard && git clean -df"
|
||||
alias gs="git status"
|
||||
alias whoops="git reset --hard && git clean -df"
|
||||
|
||||
# Create a new directory and enter it
|
||||
function mkd() {
|
||||
mkdir -p "$@" && cd "$@"
|
||||
}
|
||||
|
||||
function md() {
|
||||
mkdir -p "$@" && cd "$@"
|
||||
}
|
||||
|
||||
function xtree {
|
||||
find ${1:-.} -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
|
||||
}
|
||||
|
||||
# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
|
||||
# the `.git` directory, listing directories first. The output gets piped into
|
||||
# `less` with options to preserve color and line numbers, unless the output is
|
||||
# small enough for one screen.
|
||||
function tre() {
|
||||
tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX;
|
||||
}
|
||||
|
||||
# Determine size of a file or total size of a directory
|
||||
function fs() {
|
||||
if du -b /dev/null > /dev/null 2>&1; then
|
||||
local arg=-sbh;
|
||||
else
|
||||
local arg=-sh;
|
||||
fi
|
||||
if [[ -n "$@" ]]; then
|
||||
du $arg -- "$@";
|
||||
else
|
||||
du $arg .[^.]* ./*;
|
||||
fi;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -z ${PHP_CRONTABS_PATH+x} ] && [ "$PHP_CRONTABS_PATH" != "" ]; then
|
||||
printf "env CRONTABS_PATH: setting up crontabs: ";
|
||||
|
||||
for f in ${PHP_CRONTABS_PATH}; do
|
||||
printf "$f, ";
|
||||
rm -f /etc/cron.d/${f##*/}
|
||||
cp $f /etc/cron.d/
|
||||
chmod 0644 /etc/cron.d/${f##*/}
|
||||
done
|
||||
|
||||
echo
|
||||
printenv | grep -v "no_proxy" >> /etc/environment
|
||||
|
||||
/etc/init.d/cron start > /dev/null
|
||||
fi
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
/usr/local/bin/php -v
|
||||
|
||||
### create system user for php pool
|
||||
if [ ! -z ${PHP_USER+x} ] && [ ! -z ${PHP_UID+x} ] && [ ! -z ${PHP_GID+x} ] && [ ! -z ${PHP_HOME+x} ] && [ "$PHP_USER" != "" ] && [ "$PHP_UID" != "" ] && [ "$PHP_GID" != "" ] && [ "$PHP_HOME" != "" ]; then
|
||||
echo "env PHP_USER: creating new system user: ${PHP_USER} ${PHP_UID}:${PHP_GID} ${PHP_HOME}"
|
||||
groupadd -f $PHP_USER -g $PHP_GID && \
|
||||
useradd -d $PHP_HOME -u $PHP_UID -g $PHP_GID -s /bin/false $PHP_USER
|
||||
fi
|
||||
|
||||
### load PHP ini configurations
|
||||
if [ ! -z ${PHP_INI_PATH+x} ] && [ "$PHP_INI_PATH" != "" ]; then
|
||||
printf "env PHP_INI_PATH: "
|
||||
for f in ${PHP_INI_PATH}; do
|
||||
printf "$f, ";
|
||||
rm -f /usr/local/etc/php/conf.d/${f##*/}
|
||||
cp $f /usr/local/etc/php/conf.d/
|
||||
done
|
||||
echo
|
||||
fi
|
||||
|
||||
### make sure to create clean php-fpm.conf
|
||||
### to avoid adding multiple times the same lines next
|
||||
### in case container is restarting
|
||||
echo "[global]" > /usr/local/etc/php-fpm.conf
|
||||
echo "include=etc/php-fpm.d/*.conf" >> /usr/local/etc/php-fpm.conf
|
||||
|
||||
### remove default www.conf pool
|
||||
### and load PHP-FPM pool configurations
|
||||
if [ ! -z ${PHP_POOL_PATH+x} ] && [ "$PHP_POOL_PATH" != "" ]; then
|
||||
|
||||
printf "env PHP_POOL_PATH: "
|
||||
for f in ${PHP_POOL_PATH}; do
|
||||
printf "$f, ";
|
||||
rm -f /usr/local/etc/php-fpm.d/${f##*/}
|
||||
cp $f /usr/local/etc/php-fpm.d/
|
||||
done
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
### load boot bash scripts
|
||||
for f in /usr/local/bin/*.sh; do
|
||||
/bin/bash -c $f
|
||||
done
|
||||
|
||||
|
||||
### load bash scripts
|
||||
if [ ! -z ${PHP_BOOT_SCRIPTS+x} ] && [ "$PHP_BOOT_SCRIPTS" != "" ]; then
|
||||
printf "env PHP_BOOT_SCRIPTS: "
|
||||
for f in ${PHP_BOOT_SCRIPTS}; do
|
||||
printf "$f, ";
|
||||
|
||||
rm -f /usr/local/bin/${f##*/}
|
||||
cp $f /usr/local/bin/
|
||||
|
||||
chmod +x /usr/local/bin/${f##*/}
|
||||
/bin/bash -c /usr/local/bin/${f##*/}
|
||||
done
|
||||
echo
|
||||
fi
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
/usr/local/bin/docker-boot
|
||||
|
||||
# first arg is `-f` or `--some-option`
|
||||
if [ "${1#-}" != "$1" ]; then
|
||||
set -- php-fpm "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -z ${NEWRELIC_LICENSE+x} ] && [ "$NEWRELIC_LICENSE" != "" ] ; then
|
||||
echo "env NEWRELIC_LICENSE: setting up newrelic license"
|
||||
sed -i "s/REPLACE_WITH_REAL_KEY/$NEWRELIC_LICENSE/g" /usr/local/etc/php/conf.d/newrelic.ini
|
||||
nrsysmond-config --set license_key=$NEWRELIC_LICENSE
|
||||
service newrelic-sysmond start > /dev/null
|
||||
fi
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This script is a sendmail wrapper for php to log calls of the php mail() function.
|
||||
* Author: Till Brehm, www.ispconfig.org
|
||||
* (Hopefully) secured by David Goodwin <david @ _palepurple_.co.uk>
|
||||
* https://www.howtoforge.com/how-to-log-emails-sent-with-phps-mail-function-to-detect-form-spam
|
||||
*/
|
||||
|
||||
$sendmail_bin = '/usr/sbin/sendmail';
|
||||
|
||||
// Get the email content
|
||||
$mail = '';
|
||||
$logline = '';
|
||||
$pointer = fopen('php://stdin', 'r');
|
||||
|
||||
while ($line = fgets($pointer)) {
|
||||
if (preg_match('/^to:/i', $line) || preg_match('/^from:/i', $line)) {
|
||||
$logline .= trim($line) . ' ';
|
||||
}
|
||||
$mail .= $line;
|
||||
}
|
||||
|
||||
// Compose the sendmail command
|
||||
$command = 'echo ' . escapeshellarg($mail) . ' | ' . $sendmail_bin . ' -t -i';
|
||||
|
||||
if (isset($_SERVER['argc'])) {
|
||||
for ($i = 1; $i < $_SERVER['argc']; $i++) {
|
||||
$command .= escapeshellarg($_SERVER['argv'][$i]) . ' ';
|
||||
}
|
||||
}
|
||||
|
||||
// Write the log
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite($stdout, (isset($_ENV['USER']) ? $_ENV['USER'] . ' ' : '') . $logline . ' - ' . $command . "\n");
|
||||
|
||||
// Execute the command
|
||||
return shell_exec($command);
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -z ${SMTP_LOGIN+x} ] && [ ! -z ${SMTP_PASSWORD+x} ] && [ "$SMTP_LOGIN" != "" ] && [ "$SMTP_PASSWORD" != "" ]; then
|
||||
echo "env SMTP_LOGIN: sendgrid credentials for email routing";
|
||||
echo "[smtp.sendgrid.net]:2525 ${SMTP_LOGIN}:${SMTP_PASSWORD}" >> /etc/postfix/sasl_passwd
|
||||
|
||||
postmap /etc/postfix/sasl_passwd
|
||||
chmod 600 /etc/postfix/sasl_passwd.db
|
||||
rm /etc/postfix/sasl_passwd
|
||||
|
||||
### update email relay configuration for SendGrid
|
||||
sed -i 's/default_transport = error//g' /etc/postfix/main.cf && \
|
||||
sed -i 's/relay_transport = error//g' /etc/postfix/main.cf && \
|
||||
sed -i 's/relayhost = //g' /etc/postfix/main.cf && \
|
||||
|
||||
echo "relayhost = [smtp.sendgrid.net]:2525" >> /etc/postfix/main.cf && \
|
||||
echo "smtp_tls_security_level = encrypt" >> /etc/postfix/main.cf && \
|
||||
echo "smtp_sasl_auth_enable = yes" >> /etc/postfix/main.cf && \
|
||||
echo "smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd" >> /etc/postfix/main.cf && \
|
||||
echo "header_size_limit = 4096000" >> /etc/postfix/main.cf && \
|
||||
echo "smtp_sasl_security_options = noanonymous" >> /etc/postfix/main.cf
|
||||
|
||||
/etc/init.d/postfix start > /dev/null
|
||||
fi
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
### update PHP session handler
|
||||
if [ ! -z ${PHP_SESSION_HANDLER+x} ] && [ ! -z ${PHP_SESSION_PATH+x} ] && [ "$PHP_SESSION_HANDLER" != "" ] && [ "$PHP_SESSION_PATH" != "" ]; then
|
||||
echo "env PHP_SESSION_HANDLER: updating php session handler [ $PHP_SESSION_PATH ]"
|
||||
echo "session.save_handler = $PHP_SESSION_HANDLER" > /usr/local/etc/php/conf.d/zz-session.ini
|
||||
echo "session.save_path = \"$PHP_SESSION_PATH\"" >> /usr/local/etc/php/conf.d/zz-session.ini
|
||||
fi
|
||||
Reference in New Issue
Block a user