Adjust prod Docker

This commit is contained in:
cytopia
2018-02-27 23:38:09 +01:00
parent f5491d91fc
commit 6d35b06c45
33 changed files with 914 additions and 470 deletions

View File

@@ -1,4 +1,4 @@
# Auto-generated via Ansible
# Auto-generated via Ansible: edit build/ansible/DOCKERFILES/Dockerfile-base.j2 instead.
FROM php:{{ php_version }}-fpm
MAINTAINER "cytopia" <cytopia@everythingcli.org>

View File

@@ -1,4 +1,4 @@
# Auto-generated via Ansible
# Auto-generated via Ansible: edit build/ansible/DOCKERFILES/Dockerfile-mods.j2 instead.
FROM devilbox/php-fpm:{{ php_version }}-base
MAINTAINER "cytopia" <cytopia@everythingcli.org>

View File

@@ -1,4 +1,4 @@
# Auto-generated via Ansible
# Auto-generated via Ansible: edit build/ansible/DOCKERFILES/Dockerfile-prod.j2 instead.
FROM devilbox/php-fpm:{{ php_version }}-mods
MAINTAINER "cytopia" <cytopia@everythingcli.org>
@@ -35,19 +35,6 @@ RUN set -x \
###
### Configure
###
RUN set -x \
&& { \
echo "[mail function]"; \
echo "sendmail_path = /usr/sbin/sendmail -t -i"; \
echo ";mail.force_extra_parameters ="; \
echo "mail.add_x_header = On"; \
echo "mail.log = /var/log/php/mail.log"; \
} > /usr/local/etc/php/conf.d/devilbox-mail.ini
{% if debug %}
###
### Verify

View File

@@ -1,4 +1,4 @@
# Auto-generated via Ansible
# Auto-generated via Ansible: edit build/ansible/DOCKERFILES/Dockerfile-work.j2 instead.
FROM devilbox/php-fpm:{{ php_version }}-prod
MAINTAINER "cytopia" <cytopia@everythingcli.org>
@@ -15,7 +15,7 @@ LABEL \
###
### Envs (Already set in parent container)
### Envs
###
ENV BASH_PROFILE=".bashrc"
@@ -23,9 +23,37 @@ ENV BASH_PROFILE=".bashrc"
###
### Install Tools
###
# System dev 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 \
@@ -49,14 +77,15 @@ RUN set -x \
less \
libc-dev \
make \
# mongo-tools \
mongodb-clients \
mongodb-org-shell \
mongodb-org-tools \
moreutils \
mysql-client \
nano \
net-tools \
netcat \
# postgresql-client \
nodejs \
postgresql-client \
python-pip \
rubygems \
ruby-dev \
@@ -73,97 +102,37 @@ RUN set -x \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps \
&& rm -rf /var/lib/apt/lists/*
## Node / NPM
#RUN set -x \
# && mkdir -p /usr/local/src \
# && VERSION="$( curl -Lq https://nodejs.org 2>/dev/null | grep LTS | grep -Eo 'data-version.*.' | grep -oE 'v[0-9.]+' )" \
# && wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 --tries=30 \
# -P /usr/local/src https://nodejs.org/dist/${VERSION}/node-${VERSION}-linux-x64.tar.xz \
# && unxz /usr/local/src/node-${VERSION}-linux-x64.tar.xz \
# && tar xvf /usr/local/src/node-${VERSION}-linux-x64.tar -C /usr/local/src \
# && ln -s /usr/local/src/node-${VERSION}-linux-x64 /usr/local/node \
# && ln -s /usr/local/node/bin/* /usr/local/bin/ \
# && rm -rf /usr/local/src/node-${VERSION}-linux-x64.tar* \
# && rm -rf /usr/local/src/node-${VERSION}-linux-x64/LICENSE \
# && rm -rf /usr/local/src/node-${VERSION}-linux-x64/*.md \
# && rm -rf /usr/local/src/node-${VERSION}-linux-x64/include \
# && rm -rf /usr/local/src/node-${VERSION}-linux-x64/share \
# && npm --version | grep -E '[.0-9]+' \
# && node --version | grep -E '[.0-9]+' \
# && rm -rf /root/.config
#
## Composer
#RUN set -x \
# && curl -sS https://getcomposer.org/installer | php \
# && mv composer.phar /usr/local/bin/composer \
# && composer self-update
## && composer --version 2>/dev/null | grep -E 'version\s*[.0-9]+' \
## && rm -rf /root/.composer
#
## Drush
#RUN set -x \
# && DRUSH_VERSION="$( curl -q https://api.github.com/repos/drush-ops/drush/releases 2>/dev/null | grep tag_name | grep -Eo '\"[0-9.]+\"' | head -1 | sed 's/\"//g' )" \
# && mkdir -p /usr/local/src \
# && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush \
# && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush \
# && v="${DRUSH_VERSION}" su ${MY_USER} -p -c 'cd /usr/local/src/drush && git checkout ${v}' \
# && su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush && composer install --no-interaction --no-progress' \
# && ln -s /usr/local/src/drush/drush /usr/local/bin/drush \
# && drush --version | grep -E '[.0-9]+' \
# && rm -rf /usr/local/src/drush/.git \
# && rm -rf /usr/local/src/drush/docs \
# && rm -rf /usr/local/src/drush/examples \
# && rm -rf /usr/local/src/drush/misc \
# && rm -rf /usr/local/src/drush/tests \
# && rm -rf /root/.drush \
# && rm -rf /home/${MY_USER}/.composer
#
## Drupal Console
#RUN set -x \
# && curl https://drupalconsole.com/installer -L -o drupal.phar \
# && mv drupal.phar /usr/local/bin/drupal \
# && chmod +x /usr/local/bin/drupal
## && drupal --version | grep -E 'version\s*[.0-9]'
#
## WP-CLI
#RUN set -x \
# && curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
# && mv wp-cli.phar /usr/local/bin/wp \
# && chmod +x /usr/local/bin/wp \
# && wp cli update \
# && wp --allow-root --version | grep -E '[.0-9]+'
#
## Symfony CLI
#RUN set -x \
# && curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony \
# && chmod +x /usr/local/bin/symfony \
# && symfony --version | grep -E 'version\s*[.0-9]+'
#
## Laravel CLI
#RUN set -x \
# && mkdir -p /usr/local/src \
# && git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \
# && cd /usr/local/src/laravel-installer \
# && git checkout $(git describe --abbrev=0 --tags) \
# && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/laravel-installer \
# && su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/laravel-installer && composer install' \
# && ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel \
# && rm -rf /usr/local/src/laravel-installer/laravel/.git
## && laravel --version | grep -E 'version\s*[.0-9]+' \
## && rm -rf /home/${MY_USER}/.composer
#
## Phalcon DevTools
##RUN set -x \
## && mkdir -p /usr/local/src \
## && git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \
## && cd /usr/local/src/phalcon-devtools \
## && git checkout $(git tag | grep 'v3.0' | sort -V | tail -1) \
## && su - ${MY_USER} -c 'cd /usr/local/src/phalcon-devtools && ./phalcon.sh' \
## && ln -s /usr/local/src/phalcon-devtools/phalcon.php /usr/local/bin/phalcon \
## && cd / \
## && rm -rf /usr/local/src/phalcon-devtools/.git \
## && phalcon commands | grep -E '[.0-9]+'
#
{% 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 \
@@ -279,6 +248,15 @@ RUN set -x \
&& 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 %}
###

View File

@@ -27,8 +27,201 @@ php_all_versions:
- 7.2
php_conf_dir: /usr/local/etc/php.d
################################################################################
# Defines for Dockerfile "work"
################################################################################
###
### Apt repositories to actually enable
###
apt_repositories_enabled:
- backports
- git
- mongo
- node
- pgsql
###
### Software to actually install
###
software_enabled:
- composer
- drush
- drupalconsole
- wpcli
- symfony
- laravel
- phalcon
###
### All available extra repositories
###
# all: is generic version of defines
# 7.2: is specific version of defines
# disabled: [optional] Array of PHP versions for which to disable this module
#
# all, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4:
# deb: Deb line to add to sources list
# key: [optional] Key id to add for repository
# pre: [optional] Run custom command to add gpg key for repository
#
apt_repositories_available:
backports:
all:
deb: deb http://ftp.debian.org/debian jessie-backports main
git:
disabled: []
7.2:
deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu artful main
all:
deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu wily main
key: A1715D88E1DF1F24
mongo:
#disabled: [7.2]
all:
deb: deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.6 main
key: 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
node:
disabled: []
7.2:
deb: deb http://deb.nodesource.com/node_8.x stretch main
all:
deb: deb http://deb.nodesource.com/node_8.x jessie main
pre: curl -q "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" 2>/dev/null | apt-key add -
pgsql:
#disabled: [7.2]
7.2:
deb: deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main
all:
deb: deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main
pre: curl -q https://www.postgresql.org/media/keys/ACCC4CF8.asc 2>/dev/null | apt-key add -
###
### All available software
###
# all: is generic version of defines
# 7.2: is specific version of defines
# disabled: [optional] Array of PHP versions for which to disable this module
#
# all, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4:
# pre: [optional] Run command before 'command:' statement
# command: Command to execute
# pre: [optional] Run command after 'command:' statement
#
software_available:
composer:
check: composer --version 2>/dev/null | grep -E 'version\s*[.0-9]+' && rm -rf /root/.composer
all:
command: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
drush:
check: drush --version | grep -E '[.0-9]+' && rm -rf /root/.drush
5.5:
pre: |
git clone https://github.com/drush-ops/drush.git /usr/local/src/drush \
&& cd /usr/local/src/drush \
&& git checkout $(git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | sed 's/^.*tags\///g' | grep ^8 | tail -1) \
5.4:
pre: |
git clone https://github.com/drush-ops/drush.git /usr/local/src/drush \
&& cd /usr/local/src/drush \
&& git checkout $(git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | sed 's/^.*tags\///g' | grep ^8 | tail -1) \
all:
pre: |
git clone https://github.com/drush-ops/drush.git /usr/local/src/drush \
&& cd /usr/local/src/drush \
&& git checkout $(git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | tail -1 | sed 's/^.*tags\///g') \
command: |
chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush \
&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush && composer install --no-interaction --no-progress' \
&& ln -s /usr/local/src/drush/drush /usr/local/bin/drush \
&& rm -rf /usr/local/src/drush/.git \
&& rm -rf /usr/local/src/drush/docs \
&& rm -rf /usr/local/src/drush/examples \
&& rm -rf /usr/local/src/drush/misc \
&& rm -rf /usr/local/src/drush/tests \
&& rm -rf /home/${MY_USER}/.composer \
drupalconsole:
disabled: [5.4]
check: drupal --version | grep -E 'Drupal Console Launcher\s*[.0-9]'
all:
command: curl https://drupalconsole.com/installer -L -o /usr/local/bin/drupal
post: chmod +x /usr/local/bin/drupal
laravel:
check: laravel --version | grep -E '(Installer|version)\s*[.0-9]+'
7.0:
pre: |
git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \
&& cd /usr/local/src/laravel-installer \
&& git checkout v2.0.0 \
5.6:
pre: |
git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \
&& cd /usr/local/src/laravel-installer \
&& git checkout v2.0.0 \
5.5:
pre: |
git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \
&& cd /usr/local/src/laravel-installer \
&& git checkout v2.0.0 \
5.4:
pre: |
git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \
&& cd /usr/local/src/laravel-installer \
&& git checkout v1.3.7 \
all:
pre: |
git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \
&& cd /usr/local/src/laravel-installer \
&& git checkout $(git describe --abbrev=0 --tags) \
command: |
chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/laravel-installer \
&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/laravel-installer && composer install' \
&& ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel \
&& rm -rf /usr/local/src/laravel-installer/laravel/.git \
phalcon:
check: phalcon commands | grep -E '[.0-9]+'
5.4:
pre: |
git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \
&& cd /usr/local/src/phalcon-devtools \
&& git checkout v2.0.9 \
all:
pre: |
git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \
&& cd /usr/local/src/phalcon-devtools \
&& git checkout $(git describe --abbrev=0 --tags) \
command: |
chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/phalcon-devtools \
&& su - ${MY_USER} -c 'cd /usr/local/src/phalcon-devtools && ./phalcon.sh' \
&& ln -s /usr/local/src/phalcon-devtools/phalcon.php /usr/local/bin/phalcon \
&& cd / \
&& rm -rf /usr/local/src/phalcon-devtools/.git \
symfony:
check: symfony --version | grep -E 'version\s*[.0-9]+'
all:
command: curl https://symfony.com/installer -L -o /usr/local/bin/symfony
post: chmod +x /usr/local/bin/symfony
wpcli:
check: wp --allow-root --version | grep -E '[.0-9]+'
all:
command: curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp
post: chmod +x /usr/local/bin/wp
################################################################################
# Defines for Dockerfile "mods"
################################################################################
###
### Extensions to actually enable
@@ -120,7 +313,6 @@ extensions_enabled:
###
### All available php modules
###
# all: is generic version of defines
# 7.2: is specific version of defines
# disabled: [optional] Array of PHP versions for which to disable this module