mirror of
https://github.com/devilbox/docker-php-fpm.git
synced 2025-12-19 23:41:15 +00:00
300 lines
9.2 KiB
Django/Jinja
300 lines
9.2 KiB
Django/Jinja
# Auto-generated via Ansible: edit build/ansible/DOCKERFILES/Dockerfile-work.j2 instead.
|
|
FROM devilbox/php-fpm:{{ php_version }}-prod
|
|
MAINTAINER "cytopia" <cytopia@everythingcli.org>
|
|
|
|
|
|
###
|
|
### Labels
|
|
###
|
|
LABEL \
|
|
name="cytopia's PHP-FPM {{ php_version }} Image" \
|
|
image="devilbox/php-fpm" \
|
|
tag="{{ php_version }}-work" \
|
|
vendor="devilbox" \
|
|
license="MIT"
|
|
|
|
|
|
###
|
|
### Envs
|
|
###
|
|
ENV BASH_PROFILE=".bashrc"
|
|
|
|
|
|
###
|
|
### Install Tools
|
|
###
|
|
RUN set -x \
|
|
&& apt-get update \
|
|
&& apt-get install --no-install-recommends --no-install-suggests -y \
|
|
dirmngr \
|
|
gnupg \
|
|
{% for repo in apt_repositories_enabled %}
|
|
{# Not disabled #}
|
|
{% if ('disabled' not in apt_repositories_available[repo]) or (php_version not in apt_repositories_available[repo]['disabled']) %}
|
|
{# Version specific pre-command available? #}
|
|
{% if php_version in apt_repositories_available[repo] and 'pre' in apt_repositories_available[repo][php_version] %}
|
|
&& {{ apt_repositories_available[repo][php_version]['pre'] }} \
|
|
{# Generic pre-command available? #}
|
|
{% elif 'all' in apt_repositories_available[repo] and 'pre' in apt_repositories_available[repo]['all'] %}
|
|
&& {{ apt_repositories_available[repo]['all']['pre'] }} \
|
|
{% endif %}
|
|
{# Version specific key available? #}
|
|
{% if php_version in apt_repositories_available[repo] and 'key' in apt_repositories_available[repo][php_version] %}
|
|
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv {{ apt_repositories_available[repo][php_version]['key'] }} \
|
|
{# Generic key available? #}
|
|
{% elif 'all' in apt_repositories_available[repo] and 'key' in apt_repositories_available[repo]['all'] %}
|
|
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv {{ apt_repositories_available[repo]['all']['key'] }} \
|
|
{% endif %}
|
|
{# Version specific repository available? #}
|
|
{% if php_version in apt_repositories_available[repo] and 'deb' in apt_repositories_available[repo][php_version] %}
|
|
&& echo "{{ apt_repositories_available[repo][php_version]['deb'] }}" > /etc/apt/sources.list.d/{{ repo }}.list \
|
|
{# Generic repository available? #}
|
|
{% else %}
|
|
&& echo "{{ apt_repositories_available[repo]['all']['deb'] }}" > /etc/apt/sources.list.d/{{ repo }}.list \
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
&& apt-get update \
|
|
&& apt-get install --no-install-recommends --no-install-suggests -y \
|
|
ack-grep \
|
|
aspell \
|
|
autoconf \
|
|
automake \
|
|
bash-completion \
|
|
bzip2 \
|
|
coreutils \
|
|
curl \
|
|
dnsutils \
|
|
dos2unix \
|
|
file \
|
|
gcc \
|
|
git \
|
|
git-svn \
|
|
hostname \
|
|
htop \
|
|
imagemagick \
|
|
iputils-ping \
|
|
less \
|
|
libc-dev \
|
|
make \
|
|
mongodb-org-shell \
|
|
mongodb-org-tools \
|
|
moreutils \
|
|
mysql-client \
|
|
nano \
|
|
net-tools \
|
|
netcat \
|
|
nodejs \
|
|
postgresql-client \
|
|
python-pip \
|
|
rubygems \
|
|
ruby-dev \
|
|
shellcheck \
|
|
silversearcher-ag \
|
|
subversion \
|
|
sudo \
|
|
tig \
|
|
vim \
|
|
w3m \
|
|
wget \
|
|
whois \
|
|
xz-utils \
|
|
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
{% for tool in software_enabled %}
|
|
{# Not disabled #}
|
|
{% if ('disabled' not in software_available[tool]) or (php_version not in software_available[tool]['disabled']) %}
|
|
# {{ tool }}
|
|
RUN set -x true \
|
|
{# Version specific pre-command available? #}
|
|
{% if php_version in software_available[tool] and 'pre' in software_available[tool][php_version] %}
|
|
&& {{ software_available[tool][php_version]['pre'] }} \
|
|
{# Generic pre-command available? #}
|
|
{% elif 'all' in software_available[tool] and 'pre' in software_available[tool]['all'] %}
|
|
&& {{ software_available[tool]['all']['pre'] }} \
|
|
{% endif %}
|
|
{# Version specific command available? #}
|
|
{% if php_version in software_available[tool] and 'command' in software_available[tool][php_version] %}
|
|
&& {{ software_available[tool][php_version]['command'] }} \
|
|
{# Generic command available? #}
|
|
{% else %}
|
|
&& {{ software_available[tool]['all']['command'] }} \
|
|
{% endif %}
|
|
{# Version specific post-command available? #}
|
|
{% if php_version in software_available[tool] and 'post' in software_available[tool][php_version] %}
|
|
&& {{ software_available[tool][php_version]['post'] }} \
|
|
{# Generic post-command available? #}
|
|
{% elif 'all' in software_available[tool] and 'post' in software_available[tool]['all'] %}
|
|
&& {{ software_available[tool]['all']['post'] }} \
|
|
{% endif %}
|
|
&& true
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
## Mysqldump-secure
|
|
#RUN set -x \
|
|
# && mkdir -p /usr/local/src \
|
|
# && git clone https://github.com/cytopia/mysqldump-secure.git /usr/local/src/mysqldump-secure \
|
|
# && cd /usr/local/src/mysqldump-secure \
|
|
# && git checkout $(git describe --abbrev=0 --tags) \
|
|
# && cp /usr/local/src/mysqldump-secure/bin/mysqldump-secure /usr/local/bin \
|
|
# && cp /usr/local/src/mysqldump-secure/etc/mysqldump-secure.conf /etc \
|
|
# && cp /usr/local/src/mysqldump-secure/etc/mysqldump-secure.cnf /etc \
|
|
# && touch /var/log/mysqldump-secure.log \
|
|
# && chown ${MY_USER}:${MY_GROUP} /etc/mysqldump-secure.* \
|
|
# && chown ${MY_USER}:${MY_GROUP} /var/log/mysqldump-secure.log \
|
|
# && chmod 0400 /etc/mysqldump-secure.conf \
|
|
# && chmod 0400 /etc/mysqldump-secure.cnf \
|
|
# && chmod 0644 /var/log/mysqldump-secure.log \
|
|
# && sed -i'' 's/^COMPRESS_ARG=.*/COMPRESS_ARG="-9 -c"/g' /etc/mysqldump-secure.conf \
|
|
# && sed -i'' 's/^DUMP_DIR=.*/DUMP_DIR="\/shared\/backups\/mysql"/g' /etc/mysqldump-secure.conf \
|
|
# && sed -i'' 's/^DUMP_DIR_CHMOD=.*/DUMP_DIR_CHMOD="0755"/g' /etc/mysqldump-secure.conf \
|
|
# && sed -i'' 's/^DUMP_FILE_CHMOD=.*/DUMP_FILE_CHMOD="0644"/g' /etc/mysqldump-secure.conf \
|
|
# && sed -i'' 's/^LOG_CHMOD=.*/LOG_CHMOD="0644"/g' /etc/mysqldump-secure.conf \
|
|
# && sed -i'' 's/^NAGIOS_LOG=.*/NAGIOS_LOG=0/g' /etc/mysqldump-secure.conf \
|
|
# \
|
|
# && cd / \
|
|
# && rm -rf /usr/local/src/mysqldump-secure \
|
|
# && mysqldump-secure --version | grep -E 'Version:\s*[.0-9]+'
|
|
#
|
|
## Awesome-CI
|
|
#RUN set -x \
|
|
# && mkdir -p /usr/local/src \
|
|
# && git clone https://github.com/cytopia/awesome-ci.git /usr/local/src/awesome-ci \
|
|
# && cd /usr/local/src/awesome-ci \
|
|
# && git checkout $(git describe --abbrev=0 --tags) \
|
|
# && ./configure --prefix=/usr/local \
|
|
# && make install \
|
|
# && cd / \
|
|
# && rm -rf /usr/local/src/awesome-ci
|
|
#
|
|
## Awesome-CI requirements
|
|
#RUN set -x \
|
|
# && gem install mdl \
|
|
# && gem install scss_lint \
|
|
# && npm install -g eslint \
|
|
# && npm install -g jsonlint \
|
|
# && npm install -g mdlint \
|
|
# && npm install -g gulp \
|
|
# && rm -rf /root/.gem \
|
|
# && rm -rf /root/.npm \
|
|
# && rm -rf /root/.config \
|
|
# && rm -rf /tmp/*
|
|
#
|
|
## Grunt
|
|
#RUN set -x \
|
|
# && npm install -g grunt \
|
|
# && npm install -g grunt-cli \
|
|
# && /usr/local/node/bin/grunt --version | grep -E 'v[.0-9]+' \
|
|
# && rm -rf /root/.npm \
|
|
# && rm -rf /root/.config \
|
|
# && rm -rf /tmp/*
|
|
#
|
|
## Webpack
|
|
#RUN set -x \
|
|
# && npm install -g --save-dev webpack \
|
|
# && /usr/local/node/bin/webpack --version | grep -E '[.0-9]+' \
|
|
# && rm -rf /root/.npm \
|
|
# && rm -rf /root/.config \
|
|
# && rm -rf /tmp/*
|
|
#
|
|
## Linuxbrew
|
|
#RUN set -x \
|
|
# && mkdir -p /usr/local/src \
|
|
# && git clone https://github.com/Linuxbrew/brew.git /usr/local/src/linuxbrew \
|
|
# && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/linuxbrew \
|
|
# && v="${BASH_PROFILE}" su ${MY_USER} -c -p \
|
|
# 'echo "PATH=/usr/local/src/linuxbrew/bin:/usr/local/src/linuxbrew/sbin:/usr/bin:/usr/sbin:/bin:/sbin" >> /home/devilbox/${v}' \
|
|
# && v="${BASH_PROFILE}" su ${MY_USER} -c -p \
|
|
# 'echo "export MANPATH=/usr/local/src/linuxbrew/share/man:${MANPATH}" >> /home/devilbox/${v}' \
|
|
# && v="${BASH_PROFILE}" su ${MY_USER} -c -p \
|
|
# 'echo "export INFOPATH=/usr/local/src/linuxbrew/share/man:${INFOPATH}" >> /home/devilbox/${v}' \
|
|
# && su - ${MY_USER} -c '/usr/local/src/linuxbrew/bin/brew update' \
|
|
# && su - ${MY_USER} -c '/usr/local/src/linuxbrew/bin/brew config' | grep -E 'HOMEBREW_VERSION:\s*[.0-9]+' \
|
|
# && rm -rf /home/${MY_USER}/.cache
|
|
#
|
|
#
|
|
#
|
|
####
|
|
#### Configure Bash
|
|
####
|
|
#RUN \
|
|
# { \
|
|
# echo "PATH=\${PATH}:/usr/local/bin:/usr/local/sbin:/usr/local/node/bin"; \
|
|
# echo "export PATH"; \
|
|
# echo ". /etc/bash-devilbox"; \
|
|
# echo "if [ -d /etc/bash-custom.d/ ]; then"; \
|
|
# echo " for f in /etc/bash-custom.d/*.sh ; do"; \
|
|
# echo " if [ -r \"\${f}\" ]; then"; \
|
|
# echo " . \"\${f}\""; \
|
|
# echo " fi"; \
|
|
# echo " done"; \
|
|
# echo " unset f"; \
|
|
# echo "fi"; \
|
|
# } | tee -a /home/${MY_USER}/${BASH_PROFILE} /root/${BASH_PROFILE} \
|
|
# && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/${BASH_PROFILE}
|
|
#
|
|
|
|
|
|
{% if debug %}
|
|
###
|
|
### Verify
|
|
###
|
|
RUN set -x \
|
|
&& php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^{{ php_version }}' \
|
|
&& /usr/local/sbin/php-fpm --test \
|
|
&& PHP_ERROR="$( php -v 2>&1 1>/dev/null )" \
|
|
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi
|
|
|
|
RUN set -x \
|
|
{% for tool in software_enabled %}
|
|
{# Not disabled #}
|
|
{% if ('disabled' not in software_available[tool]) or (php_version not in software_available[tool]['disabled']) %}
|
|
&& {{ software_available[tool]['check'] }} \
|
|
{% endif %}
|
|
{% endfor %}
|
|
&& true
|
|
|
|
|
|
{% endif %}
|
|
###
|
|
### Copy files
|
|
###
|
|
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
|
|
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
|
|
COPY ./data/bash-devilbox /etc/bash-devilbox
|
|
COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
|
|
|
|
|
|
|
|
###
|
|
### Volumes
|
|
###
|
|
VOLUME /etc/bash-custom.d
|
|
VOLUME /etc/php-custom.d
|
|
VOLUME /etc/php-modules.d
|
|
VOLUME /shared/backups
|
|
VOLUME /var/log/php
|
|
VOLUME /var/mail
|
|
|
|
|
|
|
|
###
|
|
### Ports
|
|
###
|
|
EXPOSE 9000
|
|
|
|
|
|
###
|
|
### Where to start inside the container
|
|
###
|
|
WORKDIR /shared/httpd
|
|
|
|
|
|
###
|
|
### Entrypoint
|
|
###
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|