diff --git a/.ansible/DOCKERFILES/Dockerfile-base.j2 b/.ansible/DOCKERFILES/Dockerfile-base.j2 index 21acdc7..1f92534 100644 --- a/.ansible/DOCKERFILES/Dockerfile-base.j2 +++ b/.ansible/DOCKERFILES/Dockerfile-base.j2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile {{ edit_comment_base }} {% if php_version == 5.2 %} FROM devilbox/php-fpm-5.2 diff --git a/.ansible/DOCKERFILES/Dockerfile-mods.j2 b/.ansible/DOCKERFILES/Dockerfile-mods.j2 index ad90902..3ad6f32 100644 --- a/.ansible/DOCKERFILES/Dockerfile-mods.j2 +++ b/.ansible/DOCKERFILES/Dockerfile-mods.j2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile {{ edit_comment_mods }} FROM devilbox/php-fpm:{{ php_version }}-base as builder @@ -304,7 +305,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/.ansible/DOCKERFILES/Dockerfile-prod.j2 b/.ansible/DOCKERFILES/Dockerfile-prod.j2 index 318d6e6..d3686c7 100644 --- a/.ansible/DOCKERFILES/Dockerfile-prod.j2 +++ b/.ansible/DOCKERFILES/Dockerfile-prod.j2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile {{ edit_comment_prod }} FROM devilbox/php-fpm:{{ php_version }}-mods MAINTAINER "cytopia" diff --git a/.ansible/DOCKERFILES/Dockerfile-slim.j2 b/.ansible/DOCKERFILES/Dockerfile-slim.j2 new file mode 100644 index 0000000..1901fdd --- /dev/null +++ b/.ansible/DOCKERFILES/Dockerfile-slim.j2 @@ -0,0 +1,533 @@ +# vi: ft=dockerfile +{{ edit_comment_slim }} +{% import './jinja2/macros-work.j2' as fn %} + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:{{ php_version }}-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ +{%- for repo in base_apt_repositories_enabled -%} + {#- Not disabled -#} + {%- if ('disabled' not in base_apt_repositories_available[repo]) or (php_version not in base_apt_repositories_available[repo]['disabled']) -%} + {#- -#} + {#- [PRE] -#} + {%- if fn.get_pre(php_version, repo, base_apt_repositories_available) | length -%} + {{ "\n\t" }}&& {{ fn.get_pre(php_version, repo, base_apt_repositories_available) | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- [KEY] -#} + {%- if fn.tool_repo_get_key(php_version, repo, base_apt_repositories_available) | length -%} + {{ "\n\t" }}&& APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv {{ fn.tool_repo_get_key(php_version, repo, base_apt_repositories_available) }} \ + {%- endif -%} + {#- -#} + {#- [DEB] -#} + {%- if fn.tool_repo_get_deb(php_version, repo, base_apt_repositories_available) | length -%} + {{ "\n\t" }}&& echo "{{ fn.tool_repo_get_deb(php_version, repo, base_apt_repositories_available) }}" > /etc/apt/sources.list.d/{{ repo }}.list \ + {%- endif -%} + {%- endif -%} +{%- endfor -%} + {{ "\n\t" }}&& true + +{% set build_deps = [] -%} +{%- for ext in base_software_enabled -%} + {%- for dep in fn.get_build_dep(php_version, ext, base_software_available) | from_json -%} + {%- if dep -%} + {{- build_deps.append(dep) -}} + {%- endif -%} + {%- endfor -%} +{%- endfor -%} +{%- if build_deps -%} +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ +{% for build_dep in build_deps | unique | sort %} + {{ build_dep }} \ +{% endfor %} + && rm -rf /var/lib/apt/lists/* +{%- endif %} + +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ +{% if php_version in [7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2] %} + mariadb-client \ +{% else %} + mysql-client \ +{% endif %} + redis-tools \ + sqlite3 + +{% set tools_apt = [] -%} +{%- for tool in base_software_enabled -%} + {%- if ('disabled' not in base_software_available[tool]) or (php_version not in base_software_available[tool]['disabled']) -%} + {%- if fn.tool_apt_get_package(php_version, tool, base_software_available) -%} + {{- tools_apt.append(fn.tool_apt_get_package(php_version, tool, base_software_available)) -}} + {%- endif -%} + {%- endif -%} +{%- endfor %} + +{%- if tools_apt -%} +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + {{- "\n" -}} + {%- if tools_apt -%} + {{- "\t\t# ---------- type: apt ----------\n" -}} + {%- for apt in tools_apt | unique | sort -%} + {{- "\t\t" + apt + " \\" + "\n" -}} + {%- endfor -%} + {%- endif -%} + {{- "\t" -}}&& rm -rf /var/lib/apt/lists/*{{- "\n" -}} +{% endif %} + +### +### Devilbox required cli tools from group_vars (slim.yml) +### +{% for tool in base_software_enabled -%} + {# Not disabled #} + {%- if ('disabled' not in base_software_available[tool]) or (php_version not in base_software_available[tool]['disabled']) -%} + {{- "\n" }}# -------------------- {{ tool }} -------------------- + {{- "\n" }}RUN set -eux \ + {#- -#} + {#- [PRE] -#} + {%- if fn.get_pre(php_version, tool, base_software_available) | length -%} + {{ "\n\t" }}&& {{ fn.get_pre(php_version, tool, base_software_available) | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- [COMMAND] -#} + {%- if fn.get_type(php_version, tool, base_software_available) == 'custom' -%} + {{ "\n\t" }}&& {{ fn.tool_custom_get_command(php_version, tool, base_software_available) | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- [POST] -#} + {%- if fn.get_post(php_version, tool, base_software_available) | length -%} + {{ "\n\t" }}&& {{ fn.get_post(php_version, tool, base_software_available) | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- [CHECK] -#} + {%- if 'check' in base_software_available[tool] -%} + {{ "\n\t" }}&& {{ base_software_available[tool]['check'] | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- Finalize -#} + {{ "\n\t" }}&& true{{ "\n" }} + {%- endif -%} +{%- endfor %} + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:{{ php_version }}-prod as devilbox-slim-base +ARG ARCH + +{% set tools_apt = [] -%} +{%- for tool in base_software_enabled -%} + {%- if ('disabled' not in base_software_available[tool]) or (php_version not in base_software_available[tool]['disabled']) -%} + {%- if fn.tool_apt_get_package(php_version, tool, base_software_available) -%} + {{- tools_apt.append(fn.tool_apt_get_package(php_version, tool, base_software_available)) -}} + {%- endif -%} + {%- endif -%} +{%- endfor %} + +{%- if tools_apt -%} +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + {{- "\n" -}} + {%- if tools_apt -%} + {{- "\t\t# ---------- type: apt ----------\n" -}} + {%- for apt in tools_apt | unique | sort -%} + {{- "\t\t" + apt + " \\" + "\n" -}} + {%- endfor -%} + {%- endif -%} + {{- "\t" -}}&& rm -rf /var/lib/apt/lists/*{{- "\n" -}} +{% endif %} + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-{{ php_version }}.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-{{ php_version }}.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### +{% for tool in base_software_enabled -%} + {# Not disabled #} + {%- if ('disabled' not in base_software_available[tool]) or (php_version not in base_software_available[tool]['disabled']) -%} + {{- "\n" }}# -------------------- {{ tool }} -------------------- + {{- "\n" }}RUN set -eux \ + {#- -#} + {#- [CHECK] -#} + {%- if 'check' in base_software_available[tool] -%} + {{ "\n\t" }}&& {{ base_software_available[tool]['check'] | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- Finalize -#} + {{ "\n\t" }}&& true{{ "\n" }} + {%- endif -%} +{%- endfor %} + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && 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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="{{ php_version }}-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM {{ php_version }}-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM {{ php_version }}-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/.ansible/DOCKERFILES/Dockerfile-work.j2 b/.ansible/DOCKERFILES/Dockerfile-work.j2 index d4231b0..008259f 100644 --- a/.ansible/DOCKERFILES/Dockerfile-work.j2 +++ b/.ansible/DOCKERFILES/Dockerfile-work.j2 @@ -1,8 +1,538 @@ +# vi: ft=dockerfile {{ edit_comment_work }} -FROM devilbox/php-fpm:{{ php_version }}-prod -MAINTAINER "cytopia" +{% import './jinja2/macros-work.j2' as fn %} -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:{{ php_version }}-slim as devilbox-work-help-builder + +{% set build_deps = [] -%} +{%- for ext in help_software_enabled -%} + {%- for dep in fn.get_build_dep(php_version, ext, help_software_available) | from_json -%} + {%- if dep -%} + {{- build_deps.append(dep) -}} + {%- endif -%} + {%- endfor -%} +{%- endfor -%} +{%- if build_deps -%} +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ +{% for build_dep in build_deps | unique | sort %} + {{ build_dep }} \ +{% endfor %} + && rm -rf /var/lib/apt/lists/* +{%- endif %} + +{% set run_deps = [] -%} +{%- for ext in help_software_enabled -%} + {%- for dep in fn.get_run_dep(php_version, ext, help_software_available) | from_json -%} + {%- if dep -%} + {{- run_deps.append(dep) -}} + {%- endif -%} + {%- endfor -%} +{%- endfor -%} +{%- if run_deps -%} + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ +{% for run_dep in run_deps | unique | sort %} + {{ run_dep }} \ +{% endfor %} + && rm -rf /var/lib/apt/lists/* +{%- endif %} + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### +{% for tool in help_software_enabled -%} + {# Not disabled #} + {%- if ('disabled' not in help_software_available[tool]) or (php_version not in help_software_available[tool]['disabled']) -%} + {{- "\n" }}# -------------------- {{ tool }} -------------------- + {{- "\n" }}RUN set -eux \ + {#- -#} + {#- [PRE] -#} + {%- if fn.get_pre(php_version, tool, help_software_available) | length -%} + {{ "\n\t" }}&& {{ fn.get_pre(php_version, tool, help_software_available) | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- [COMMAND] -#} + {%- if fn.get_type(php_version, tool, help_software_available) == 'custom' -%} + {{ "\n\t" }}&& {{ fn.tool_custom_get_command(php_version, tool, help_software_available) | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- [POST] -#} + {%- if fn.get_post(php_version, tool, help_software_available) | length -%} + {{ "\n\t" }}&& {{ fn.get_post(php_version, tool, help_software_available) | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- Finalize -#} + {{ "\n\t" }}&& true{{ "\n" }} + {%- endif -%} +{%- endfor %} + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:{{ php_version }}-slim as devilbox-work-help + +{% set run_deps = [] -%} +{%- for ext in help_software_enabled -%} + {%- for dep in fn.get_run_dep(php_version, ext, help_software_available) | from_json -%} + {%- if dep -%} + {{- run_deps.append(dep) -}} + {%- endif -%} + {%- endfor -%} +{%- endfor -%} +{%- if run_deps -%} +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ +{% for run_dep in run_deps | unique | sort %} + {{ run_dep }} \ +{% endfor %} + && rm -rf /var/lib/apt/lists/* +{% endif %} + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="{{ nvm_home }}/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="{{ nvm_home }}"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### +{% for tool in help_software_enabled -%} + {# Not disabled #} + {%- if ('disabled' not in help_software_available[tool]) or (php_version not in help_software_available[tool]['disabled']) -%} + {{- "\n" }}# -------------------- {{ tool }} -------------------- + {{- "\n" }}RUN set -eux \ + {#- -#} + {#- [CHECK] -#} + {%- if 'check' in help_software_available[tool] -%} + {{ "\n\t" }}&& {{ help_software_available[tool]['check'] | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- Finalize -#} + {{ "\n\t" }}&& true{{ "\n" }} + {%- endif -%} +{%- endfor %} + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && 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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +{% set build_deps = [] -%} +{%- set run_deps = [] -%} +{%- set tools_apt = [] -%} +{%- for tool in tools_enabled -%} + {%- for dep in fn.get_build_dep(php_version, tool, tools_available) | from_json -%} + {%- if dep -%} + {{- build_deps.append(dep) -}} + {%- endif -%} + {%- endfor -%} + {%- for dep in fn.get_run_dep(php_version, tool, tools_available) | from_json -%} + {%- if dep -%} + {{- run_deps.append(dep) -}} + {%- endif -%} + {%- endfor -%} + {%- if ('disabled' not in tools_available[tool]) or (php_version not in tools_available[tool]['disabled']) -%} + {%- if fn.tool_apt_get_package(php_version, tool, tools_available) -%} + {{- tools_apt.append(fn.tool_apt_get_package(php_version, tool, tools_available)) -}} + {%- endif -%} + {%- endif -%} +{%- endfor %} + +{%- if build_deps or run_deps or tools_apt -%} +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + {{- "\n" -}} + {%- if build_deps -%} + {{- "\t\t# ---------- build_deps ----------\n" -}} + {%- for apt in build_deps | unique | sort -%} + {{- "\t\t" + apt + " \\" + "\n" -}} + {%- endfor -%} + {%- endif -%} + {%- if run_deps -%} + {{- "\t\t# ---------- run_deps ----------\n" -}} + {%- for apt in run_deps | unique | sort -%} + {{- "\t\t" + apt + " \\" + "\n" -}} + {%- endfor -%} + {%- endif -%} + {%- if tools_apt -%} + {{- "\t\t# ---------- type: apt ----------\n" -}} + {%- for apt in tools_apt | unique | sort -%} + {{- "\t\t" + apt + " \\" + "\n" -}} + {%- endfor -%} + {%- endif -%} + {{- "\t" -}}&& rm -rf /var/lib/apt/lists/*{{- "\n" -}} +{% endif %} + +### +### Install defined php_tools +### +{% for tool in tools_enabled -%} + {# Not disabled #} + {%- if ('disabled' not in tools_available[tool]) or (php_version not in tools_available[tool]['disabled']) -%} + {{- "\n" }}# -------------------- ({{ fn.get_type(php_version, tool, tools_available) }}) {{ tool }} -------------------- + {{- "\n" }}RUN set -eux \ + {#- -#} + {#- [PRE] -#} + {%- if fn.get_pre(php_version, tool, tools_available) | length -%} + {{ "\n\t" }}&& {{ fn.get_pre(php_version, tool, tools_available) | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- [CUSTOM] -#} + {%- if fn.get_type(php_version, tool, tools_available) == 'custom' -%} + {{ "\n\t" }}&& {{ fn.tool_custom_get_command(php_version, tool, tools_available) | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- [NPM] -#} + {%- if fn.get_type(php_version, tool, tools_available) == 'npm' -%} + {%- set npm_package = fn.tool_npm_get_package(php_version, tool, tools_available) -%} + {%- set npm_version = fn.tool_npm_get_version(php_version, tool, tools_available) -%} + {%- set npm_binary = fn.tool_npm_get_binary(php_version, tool, tools_available) -%} + {{ "\n\t" }}&& su -c '. {{ nvm_home }}/nvm.sh; npm install --location=global {{ npm_package }}{{ npm_version }}' devilbox \ + {%- if npm_binary | length -%} + {{ "\n\t" }}&& ln -s {{ nvm_home }}/versions/node/$(su -c '. {{ nvm_home }}/nvm.sh; node --version' devilbox)/bin/{{ npm_binary }} /usr/local/bin/ \ + {%- endif -%} + {%- endif -%} + {#- -#} + {#- [COMPOSER] -#} + {%- if fn.get_type(php_version, tool, tools_available) == 'composer' -%} + {%- set comp_composer = fn.tool_composer_get_composer(php_version, tool, tools_available) -%} + {%- set comp_package = fn.tool_composer_get_package(php_version, tool, tools_available) -%} + {%- set comp_version = fn.tool_composer_get_version(php_version, tool, tools_available) -%} + {%- set comp_flags = fn.tool_composer_get_flags(php_version, tool, tools_available) -%} + {%- set comp_binary = fn.tool_composer_get_binary(php_version, tool, tools_available) -%} + {#- FIXME: use su -c ' devilbox -#} + {{ "\n\t" }}&& COMPOSER_HOME="{{ composer_home }}" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-{{ comp_composer }} global require --no-interaction --no-cache {{ comp_flags }} {{ comp_package }}{{ comp_version }} \ + {%- if comp_binary | length -%} + {{ "\n\t" }}&& ln -s {{ composer_home }}/vendor/{{ comp_package }}/{{ comp_binary }} /usr/local/bin/ \ + {%- endif -%} + {{ "\n\t" }}&& rm -rf {{ composer_home }}/cache/* \ + {%- endif -%} + {#- -#} + {#- [RUBYGEM] -#} + {%- if fn.get_type(php_version, tool, tools_available) == 'rubygem' -%} + {%- set rubygem_package = fn.tool_rubygem_get_package(php_version, tool, tools_available) -%} + {%- set rubygem_version = fn.tool_rubygem_get_version(php_version, tool, tools_available) -%} + {{ "\n\t" }}&& gem install {{ rubygem_package }}{{ rubygem_version }} \ + {%- endif -%} + {#- -#} + {#- [PIP] -#} + {%- if fn.get_type(php_version, tool, tools_available) == 'pip' -%} + {%- set pip_package = fn.tool_pip_get_package(php_version, tool, tools_available) -%} + {%- set pip_version = fn.tool_pip_get_version(php_version, tool, tools_available) -%} + {{ "\n\t" }}&& pip install --no-cache-dir --no-compile --force-reinstall {{ pip_package }}{{ pip_version }} \ + {%- endif -%} + {#- -#} + {#- [POST] -#} + {%- if fn.get_post(php_version, tool, tools_available) | length -%} + {{ "\n\t" }}&& {{ fn.get_post(php_version, tool, tools_available) | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- [CHECK] -#} + {%- if 'check' in tools_available[tool] -%} + {{ "\n\t" }}&& {{ tools_available[tool]['check'] | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {#- -#} + {#- Finalize -#} + {{ "\n\t" }}&& true{{ "\n" }} + {%- endif -%} +{%- endfor %} + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +{% set run_deps = [] -%} +{%- set tools_apt = [] -%} +{%- for tool in tools_enabled -%} + {%- for dep in fn.get_run_dep(php_version, tool, tools_available) | from_json -%} + {%- if dep -%} + {{- run_deps.append(dep) -}} + {%- endif -%} + {%- endfor -%} + {%- if ('disabled' not in tools_available[tool]) or (php_version not in tools_available[tool]['disabled']) -%} + {%- if fn.tool_apt_get_package(php_version, tool, tools_available) -%} + {{- tools_apt.append(fn.tool_apt_get_package(php_version, tool, tools_available)) -}} + {%- endif -%} + {%- endif -%} +{%- endfor %} + +{%- if build_deps or run_deps or tools_apt -%} +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + {{- "\n" -}} + {%- if run_deps -%} + {{- "\t\t# ---------- run_deps ----------\n" -}} + {%- for apt in run_deps | unique | sort -%} + {{- "\t\t" + apt + " \\" + "\n" -}} + {%- endfor -%} + {%- endif -%} + {%- if tools_apt -%} + {{- "\t\t# ---------- type: apt ----------\n" -}} + {%- for apt in tools_apt | unique | sort -%} + {{- "\t\t" + apt + " \\" + "\n" -}} + {%- endfor -%} + {%- endif -%} + {{- "\t" -}}&& rm -rf /var/lib/apt/lists/*{{- "\n" -}} +{% endif %} + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + +{% for tool in tools_enabled -%} + {%- if fn.is_not_disabled(php_version, tool, tools_available) -%} + {{- "\n" }}# -------------------- ({{ fn.get_type(php_version, tool, tools_available) }}) {{ tool }} -------------------- + {{- "\n" }}RUN set -eux \ + {%- if 'check' in tools_available[tool] -%} + {{ "\n\t" }}&& {{ tools_available[tool]['check'] | indent( "\t" ) }}{{ "\t\\" }} + {%- endif -%} + {{ "\n\t" }}&& true{{ "\n" }} + {%- endif -%} +{%- endfor %} + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && 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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,578 +552,6 @@ LABEL "org.opencontainers.image.ref.name"="{{ php_version }}-work" LABEL "org.opencontainers.image.title"="PHP-FPM {{ php_version }}-work" LABEL "org.opencontainers.image.description"="PHP-FPM {{ php_version }}-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - 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] -%} - {{ "\n\t" }}&& {{ 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'] -%} - {{ "\n\t" }}&& {{ 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] -%} - {{ "\n\t" }}&& APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 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'] -%} - {{ "\n\t" }}&& APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 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] -%} - {{ "\n\t" }}&& echo "{{ apt_repositories_available[repo][php_version]['deb'] }}" > /etc/apt/sources.list.d/{{ repo }}.list \ - {#- Generic repository available? -#} - {%- elif 'all' in apt_repositories_available[repo] and 'deb' in apt_repositories_available[repo]['all'] -%} - {{ "\n\t" }}&& echo "{{ apt_repositories_available[repo]['all']['deb'] }}" > /etc/apt/sources.list.d/{{ repo }}.list \ - {%- endif -%} - {%- endif -%} -{%- endfor -%}{{ "\n\t" }}\ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ -{% if php_version not in [5.2, 5.3, 5.4, 5.5] %} - certbot \ -{% endif %} - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ -{% if php_version in [7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2] %} - mariadb-client \ -{% else %} - mysql-client \ -{% endif %} - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ -{% if php_version in [5.6, 7.0] %} - zsh-common \ -{% endif %} - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -{% if not build_fail_fast %} -RUN set -eux \ -{%- endif -%} -{%- for tool in software_enabled -%} - {# Not disabled #} - {%- if ('disabled' not in software_available[tool]) or (php_version not in software_available[tool]['disabled']) -%} - {{ "\n" }}# -------------------- {{ tool }} -------------------- - {%- if build_fail_fast -%} - {{ "\n" }}RUN set -eux \ - {%- endif -%} - {#- Version specific pre-command available? -#} - {%- if php_version in software_available[tool] and 'pre' in software_available[tool][php_version] -%} - {{ "\n\t" }}&& {{ software_available[tool][php_version]['pre'] }} \ - {#- Generic pre-command available? -#} - {%- elif 'all' in software_available[tool] and 'pre' in software_available[tool]['all'] -%} - {{ "\n\t" }}&& {{ 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] -%} - {{ "\n\t" }}&& {{ software_available[tool][php_version]['command'] }} \ - {#- Generic command available? -#} - {%- else -%} - {{ "\n\t" }}&& {{ 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] -%} - {{ "\n\t" }}&& {{ software_available[tool][php_version]['post'] }} \ - {#- Generic post-command available? -#} - {%- elif 'all' in software_available[tool] and 'post' in software_available[tool]['all'] -%} - {{ "\n\t" }}&& {{ software_available[tool]['all']['post'] }} \ - {%- endif -%} - {#- Fail fast version -#} - {%- if build_fail_fast -%} - {%- if 'check' in software_available[tool] -%} - {{ "\n\t" }}&& {{ software_available[tool]['check'] }}{{ "\n\n" }} - {%- else -%} - {{ "\n\t" }}&& true{{ "\n\n" }} - {%- endif -%} - {%- else -%} - {{ "\n\t" }}\ - {%- endif -%} - {#- end of Fail fast version -#} - {%- endif -%} -{%- endfor -%} -{% if build_fail_fast -%} - RUN set -eux \{{ "\n" }} -{%- else -%} - {{ "\n\t" }}\{{ "\n" }} -{%- endif %} - \ - {% for f in directory_to_clean %} - && (rm -rf /home/devilbox/{{ f }} || true) \ - {% endfor %} - \ - {% for f in directory_to_clean %} - && (rm -rf /root/{{ f }} || true) \ - {% endfor %} - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -{% if not build_fail_fast %} -RUN set -eux \ -{%- endif -%} -{%- for tool in composer_enabled -%} - {#- Not disabled -#} - {%- if ('disabled' not in composer_available[tool]) or (php_version not in composer_available[tool]['disabled']) -%} - {{ "\n" }}# -------------------- {{ tool }} -------------------- - {%- if build_fail_fast -%} - {{ "\n" }}RUN set -eux \ - {%- endif -%} - {#- Version specific gem version available? -#} - {%- if php_version in composer_available[tool] and 'version' in composer_available[tool][php_version] -%} - {{ "\n\t" }}&& COMPOSER_HOME="{{ composer_home }}" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-{{ composer_available[tool]['version'] }} global require {{ composer_available[tool]['name'] }}:{{ composer_available[tool][php_version]['version'] }} \ - {#- Generic gem version available? -#} - {%- elif 'all' in composer_available[tool] and 'version' in composer_available[tool]['all'] -%} - {{ "\n\t" }}&& COMPOSER_HOME="{{ composer_home }}" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-{{ composer_available[tool]['version'] }} global require {{ composer_available[tool]['name'] }}:{{ composer_available[tool]['all']['version'] }} \ - {#- No version info available -#} - {%- else -%} - {{ "\n\t" }}&& COMPOSER_HOME="{{ composer_home }}" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-{{ composer_available[tool]['version'] }} global require {{ composer_available[tool]['name'] }} \ - {%- endif -%} - {#- Symlinks available? -#} - {%- if 'link' in composer_available[tool] -%} - {{ "\n\t" }}&& ln -s {{ composer_home }}/vendor/{{ composer_available[tool]['name'] }}/{{ composer_available[tool]['link'] }} /usr/local/bin/ \ - {%- endif -%} - {#- Fail fast version -#} - {%- if build_fail_fast -%} - {%- if 'check' in composer_available[tool] -%} - {{ "\n\t" }}&& {{ composer_available[tool]['check'] }}{{ "\n\n" }} - {%- else -%} - {{ "\n\t" }}&& true{{ "\n\n" }} - {%- endif -%} - {%- else -%} - {{ "\n\t" }}\ - {%- endif -%} - {#- end of Fail fast version -#} - {%- endif -%} -{% endfor %} -{% if build_fail_fast -%} - RUN set -eux \{{ "\n" }} -{%- else -%} - {{ "\n\t" }}\{{ "\n" }} -{%- endif %} - \ - {% for f in directory_to_clean %} - && (rm -rf /home/devilbox/{{ f }} || true) \ - {% endfor %} - \ - {% for f in directory_to_clean %} - && (rm -rf /root/{{ f }} || true) \ - {% endfor %} - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -{% if not build_fail_fast %} -RUN set -eux \ -{%- endif -%} -{%- for tool in npm_enabled -%} - {#- Not disabled -#} - {%- if ('disabled' not in npm_available[tool]) or (php_version not in npm_available[tool]['disabled']) -%} - {{ "\n" }}# -------------------- {{ tool }} -------------------- - {%- if build_fail_fast -%} - {{ "\n" }}RUN set -eux \ - {%- endif -%} - {#- Version specific gem version available? -#} - {%- if php_version in npm_available[tool] and 'version' in npm_available[tool][php_version] -%} - {{ "\n\t" }}&& su -c '. {{ nvm_home }}/nvm.sh; npm install -g --force {{ npm_available[tool]['name'] }} {{ npm_available[tool][php_version]['version'] }}' devilbox \ - {#- Generic gem version available? -#} - {%- elif 'all' in npm_available[tool] and 'version' in npm_available[tool]['all'] -%} - {{ "\n\t" }}&& su -c '. {{ nvm_home }}/nvm.sh; npm install -g --force {{ npm_available[tool]['name'] }} {{ npm_available[tool]['all']['version'] }}' devilbox \ - {#- No version info available -#} - {%- else -%} - {{ "\n\t" }}&& su -c '. {{ nvm_home }}/nvm.sh; npm install -g --force {{ npm_available[tool]['name'] }}' devilbox \ - {%- endif -%} - {#- Fail fast version -#} - {%- if build_fail_fast -%} - {%- if 'check' in npm_available[tool] -%} - {{ "\n\t" }}&& PATH=$PATH:{{ nvm_home }}/versions/node/$(/bin/ls -1 {{ nvm_home }}/versions/node/ | sort -V | tail -1)/bin {{ nvm_home }}/versions/node/$(/bin/ls -1 {{ nvm_home }}/versions/node/ | sort -V | tail -1)/bin/{{ npm_available[tool]['check'] }}{{ "\n\n" }} - {%- else -%} - {{ "\n\t" }}&& true{{ "\n\n" }} - {%- endif -%} - {%- else -%} - {{ "\n\t" }}\ - {%- endif -%} - {#- end of Fail fast version -#} - {%- endif -%} -{%- endfor -%} -{% if build_fail_fast -%} - RUN set -eux \{{ "\n" }} -{%- else -%} - {{ "\n\t" }}\{{ "\n" }} -{%- endif %} - \ - && if [ -f "{{ nvm_home }}/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. {{ nvm_home }}/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. {{ nvm_home }}/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. {{ nvm_home }}/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - {% for f in directory_to_clean %} - && (rm -rf /home/devilbox/{{ f }} || true) \ - {% endfor %} - \ - {% for f in directory_to_clean %} - && (rm -rf /root/{{ f }} || true) \ - {% endfor %} - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find {{ nvm_home }} -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -{% if not build_fail_fast %} -RUN set -eux \ -{%- endif -%} -{%- for tool in gem_enabled -%} - {#- Not disabled -#} - {%- if ('disabled' not in gem_available[tool]) or (php_version not in gem_available[tool]['disabled']) -%} - {{ "\n" }}# -------------------- {{ tool }} -------------------- - {%- if build_fail_fast -%} - {{ "\n" }}RUN set -eux \ - {%- endif -%} - {#- Version specific gem version available? -#} - {%- if php_version in gem_available[tool] and 'version' in gem_available[tool][php_version] -%} - {{ "\n\t" }}&& gem install {{ gem_available[tool]['name'] }} -v {{ gem_available[tool][php_version]['version'] }} \ - {#- Generic gem version available? -#} - {%- elif 'all' in gem_available[tool] and 'version' in gem_available[tool]['all'] -%} - {{ "\n\t" }}&& gem install {{ gem_available[tool]['name'] }} -v {{ gem_available[tool]['all']['version'] }} \ - {#- No version info available -#} - {%- else -%} - {{ "\n\t" }}&& gem install {{ gem_available[tool]['name'] }} \ - {%- endif -%} - {#- Fail fast version -#} - {%- if build_fail_fast -%} - {%- if 'check' in gem_available[tool] -%} - {{ "\n\t" }}&& {{ gem_available[tool]['check'] }}{{ "\n\n" }} - {%- else -%} - {{ "\n\t" }}&& true{{ "\n\n" }} - {%- endif -%} - {%- else -%} - {{ "\n\t" }}\ - {%- endif -%} - {#- end of Fail fast version -#} - {%- endif -%} -{%- endfor -%} -{% if build_fail_fast -%} - RUN set -eux \{{ "\n" }} -{%- else -%} - {{ "\n\t" }}\{{ "\n" }} -{%- endif %} - \ - {% for f in directory_to_clean %} - && (rm -rf /home/devilbox/{{ f }} || true) \ - {% endfor %} - \ - {% for f in directory_to_clean %} - && (rm -rf /root/{{ f }} || true) \ - {% endfor %} - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -{% if not build_fail_fast %} -RUN set -eux \ -{%- endif -%} -{%- for tool in pip_enabled -%} - {#- Not disabled -#} - {%- if ('disabled' not in pip_available[tool]) or (php_version not in pip_available[tool]['disabled']) -%} - {{ "\n" }}# -------------------- {{ tool }} -------------------- - {%- if build_fail_fast -%} - {{ "\n" }}RUN set -eux \ - {%- endif -%} - {#- Version specific gem version available? -#} - {%- if php_version in pip_available[tool] and 'version' in pip_available[tool][php_version] -%} - {{ "\n\t" }}&& pip install --no-cache-dir --force-reinstall {{ pip_available[tool]['name'] }}=={{ pip_available[tool][php_version]['version'] }} || true \ - {#- Generic gem version available? -#} - {%- elif 'all' in pip_available[tool] and 'version' in pip_available[tool]['all'] -%} - {{ "\n\t" }}&& pip install --no-cache-dir --force-reinstall {{ pip_available[tool]['name'] }}=={{ pip_available[tool]['all']['version'] }} || true \ - {#- No version info available -#} - {%- else -%} - {{ "\n\t" }}&& pip install --no-cache-dir --force-reinstall {{ pip_available[tool]['name'] }} || true \ - {%- endif -%} - {#- Fail fast version -#} - {%- if build_fail_fast -%} - {%- if 'check' in pip_available[tool] -%} - {{ "\n\t" }}&& {{ pip_available[tool]['check'] }}{{ "\n\n" }} - {%- else -%} - {{ "\n\t" }}&& true{{ "\n\n" }} - {%- endif -%} - {%- else -%} - {{ "\n\t" }}\ - {%- endif -%} - {#- end of Fail fast version -#} - {%- endif -%} -{%- endfor -%} -{% if build_fail_fast -%} - RUN set -eux \{{ "\n" }} -{%- else -%} - {{ "\n\t" }}\{{ "\n" }} -{%- endif %} - \ - {% for f in directory_to_clean %} - && (rm -rf /home/devilbox/{{ f }} || true) \ - {% endfor %} - \ - {% for f in directory_to_clean %} - && (rm -rf /root/{{ f }} || true) \ - {% endfor %} - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="{{ nvm_home }}/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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 -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && 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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- -{%- for tool in software_enabled -%} - {#- Not disabled -#} - {%- if ('disabled' not in software_available[tool]) or (php_version not in software_available[tool]['disabled']) -%} - {%- if 'check' in software_available[tool] -%} - {{ "\n\t" }}&& {{ software_available[tool]['check'] }} \ - {%- endif -%} - {%- endif -%} -{%- endfor -%}{{ "\n\t" }}\ -# -------------------- Composer -------------------- -{%- for tool in composer_enabled -%} - {#- Not disabled -#} - {%- if ('disabled' not in composer_available[tool]) or (php_version not in composer_available[tool]['disabled']) -%} - {%- if 'check' in composer_available[tool] -%} - {{ "\n\t" }}&& {{ composer_available[tool]['check'] }} \ - {%- endif -%} - {%- endif -%} -{%- endfor -%}{{ "\n\t" }}\ -# -------------------- PIP -------------------- -{%- for tool in pip_enabled -%} - {#- Not disabled -#} - {%- if ('disabled' not in pip_available[tool]) or (php_version not in pip_available[tool]['disabled']) -%} - {%- if 'check' in pip_available[tool] -%} - {{ "\n\t" }}&& {{ pip_available[tool]['check'] }} \ - {%- endif -%} - {%- endif -%} -{%- endfor -%}{{ "\n\t" }}\ -# -------------------- NPM -------------------- -{%- for tool in npm_enabled -%} - {#- Not disabled -#} - {%- if ('disabled' not in npm_available[tool]) or (php_version not in npm_available[tool]['disabled']) -%} - {%- if 'check' in npm_available[tool] -%} - {{ "\n\t" }}&& {{ npm_available[tool]['check'] }} \ - {%- endif -%} - {%- endif -%} -{%- endfor -%}{{ "\n\t" }}\ -# -------------------- GEM -------------------- -{%- for tool in gem_enabled -%} - {#- Not disabled -#} - {%- if ('disabled' not in gem_available[tool]) or (php_version not in gem_available[tool]['disabled']) -%} - {%- if 'check' in gem_available[tool] -%} - {{ "\n\t" }}&& {{ gem_available[tool]['check'] }} \ - {%- endif -%} - {%- endif -%} -{% endfor %}{{ "\n\t" }}\ -# -------------------- Cleanup -------------------- - \ - {% for f in directory_to_clean %} - && (rm -rf /home/devilbox/{{ f }} || true) \ - {% endfor %} - \ - {% for f in directory_to_clean %} - && (rm -rf /root/{{ f }} || true) \ - {% endfor %} - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -{% endif %} -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-{{ php_version }}.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-{{ php_version }}.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -601,19 +559,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/.ansible/ansible.cfg b/.ansible/ansible.cfg index 23aad46..79212c9 100644 --- a/.ansible/ansible.cfg +++ b/.ansible/ansible.cfg @@ -1,3 +1,16 @@ [defaults] roles_path = ./roles inventory = inventory.ini +strategy_plugins = /usr/lib/python3.10/site-packages/ansible_mitogen/plugins/strategy +strategy = mitogen_linear + +# Show timing information +callbacks_enabled = timer, profile_tasks, profile_roles + +# Speed improvements +host_key_checking = False +internal_poll_interval = 0.001 + +[ssh_connection] +pipelining = True +ssh_args = -o ControlMaster=auto -o ControlPersist=60s diff --git a/.ansible/group_vars/all/all-ansible.yml b/.ansible/group_vars/all/all-ansible.yml index 69a7644..b35b231 100644 --- a/.ansible/group_vars/all/all-ansible.yml +++ b/.ansible/group_vars/all/all-ansible.yml @@ -6,6 +6,7 @@ edit_comment_base: "# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead." edit_comment_mods: "# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead." edit_comment_prod: "# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead." +edit_comment_slim: "# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead." edit_comment_work: "# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead." @@ -38,7 +39,7 @@ php_all_versions: # ------------------------------------------------------------------------------------------------- -# Docker file paths for each version for base, mods, prod & work +# Docker file paths for each version for base, mods, prod, slim & work # ------------------------------------------------------------------------------------------------- template_dockerfiles: - src: DOCKERFILES/Dockerfile-base.j2 @@ -47,6 +48,8 @@ template_dockerfiles: dst: "../Dockerfiles/mods/Dockerfile-{{ php_version }}" - src: DOCKERFILES/Dockerfile-prod.j2 dst: "../Dockerfiles/prod/Dockerfile-{{ php_version }}" + - src: DOCKERFILES/Dockerfile-slim.j2 + dst: "../Dockerfiles/slim/Dockerfile-{{ php_version }}" - src: DOCKERFILES/Dockerfile-work.j2 dst: "../Dockerfiles/work/Dockerfile-{{ php_version }}" @@ -55,6 +58,7 @@ template_dockerfiles: # Assign php.ini & php-fpm.conf to PHP versions # ------------------------------------------------------------------------------------------------- template_configurations: + # php.ini - src: CONFIGURATIONS/php.ini.j2 dst: "../Dockerfiles/base/data/php-ini.d/php-{{ php_version }}.ini" @@ -62,10 +66,11 @@ template_configurations: key: base alt: base - src: CONFIGURATIONS/php.ini.j2 - dst: "../Dockerfiles/work/data/php-ini.d/php-{{ php_version }}.ini" + dst: "../Dockerfiles/slim/data/php-ini.d/php-{{ php_version }}.ini" cfg: "{{ php_settings_ini }}" - key: work - alt: base # Alternative key to use when definition is not set in 'work' + key: slim + alt: base # Alternative key to use when definition is not set in 'slim' + # php-fpm.conf - src: CONFIGURATIONS/php-fpm.conf.j2 dst: "../Dockerfiles/base/data/php-fpm.conf/php-fpm-{{ php_version }}.conf" @@ -73,7 +78,7 @@ template_configurations: key: base alt: base - src: CONFIGURATIONS/php-fpm.conf.j2 - dst: "../Dockerfiles/work/data/php-fpm.conf/php-fpm-{{ php_version }}.conf" + dst: "../Dockerfiles/slim/data/php-fpm.conf/php-fpm-{{ php_version }}.conf" cfg: "{{ php_settings_fpm }}" - key: work - alt: base + key: slim + alt: base # Alternative key to use when definition is not set in 'slim' diff --git a/.ansible/group_vars/all/all-php-settings.yml b/.ansible/group_vars/all/all-php-settings.yml index 6ebc10a..63290a6 100644 --- a/.ansible/group_vars/all/all-php-settings.yml +++ b/.ansible/group_vars/all/all-php-settings.yml @@ -54,7 +54,7 @@ php_settings_ini: # ---- Inherits from base ---- prod: # ---- Inherits from base and overwrites certain values ---- - work: + slim: # Error reporting error_reporting: E_ALL | E_NOTICE | E_STRICT | E_DEPRECATED xmlrpc_errors: 'Off' @@ -73,6 +73,8 @@ php_settings_ini: xdebug3_mode: 'Off' xdebug3_start_with_request: 'default' xdebug3_client_port: '9000' + # ---- Inherits from slim ---- + work: # ------------------------------------------------------------------------------------------------- # php-fpm.conf @@ -109,5 +111,7 @@ php_settings_fpm: mods: # ---- Inherits from base ---- prod: - # ---- Inherits from base and overwrites certain values ---- + # ---- Inherits from base ---- + slim: + # ---- Inherits from base ---- work: diff --git a/.ansible/group_vars/all/mods.yml b/.ansible/group_vars/all/mods.yml index c132fd9..074eef9 100644 --- a/.ansible/group_vars/all/mods.yml +++ b/.ansible/group_vars/all/mods.yml @@ -1517,17 +1517,15 @@ extensions_available: disabled: [] all: type: pecl - 8.2: - type: git - git_url: https://github.com/xdebug/xdebug - # FIXME: revert to latest tag once PHP 8.2 support is out of alpha/beta - git_ref: 3.2.0RC2 - configure: --enable-xdebug - 8.1: - type: git - git_url: https://github.com/xdebug/xdebug - git_ref: $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1) - configure: --enable-xdebug + 7.4: + type: pecl + version: 3.1.6 + 7.3: + type: pecl + version: 3.1.6 + 7.2: + type: pecl + version: 3.1.6 7.1: type: pecl version: 2.9.8 diff --git a/.ansible/group_vars/all/slim.yml b/.ansible/group_vars/all/slim.yml new file mode 100644 index 0000000..c4aa9aa --- /dev/null +++ b/.ansible/group_vars/all/slim.yml @@ -0,0 +1,573 @@ +--- +################################################################################################### +# Docker: slim +################################################################################################### + +# +# This file holds definition for all devibox/php-fpm:x.y-slim images +# + + +### +### Define operating system versions +### +os_release: + # Bullseye (Ubuntu: focal, groovy, hirsute, impish) + all: + debian: bullseye + ubuntu: focal + 8.2: + debian: bullseye + ubuntu: focal + 8.1: + debian: bullseye + ubuntu: focal + 8.0: + debian: bullseye + ubuntu: focal + 7.4: + debian: bullseye + ubuntu: focal + 7.3: + debian: bullseye + ubuntu: focal + # Buster (Ubuntu: bionic, cosmic, disco, eoan) + 7.2: + debian: buster + ubuntu: bionic + 7.1: + debian: buster + ubuntu: bionic + # Strech (Ubuntu: xenial, yakkety, zesty, artful) + 7.0: + debian: stretch + ubuntu: xenial + 5.6: + debian: stretch + ubuntu: xenial + # Jessie (Ubuntu: trusty, utopic, vivid, wily) + 5.5: + debian: jessie + ubuntu: trusty + 5.4: + debian: jessie + ubuntu: trusty + 5.3: + debian: jessie + ubuntu: trusty + 5.2: + debian: jessie + ubuntu: trusty + + +# ------------------------------------------------------------------------------------------------- +# Apt repositories to enable (in defined order) +# ------------------------------------------------------------------------------------------------- +base_apt_repositories_enabled: + - backports + - blackfire + # - mongo # Note: This is done separately in tools (to check ARCH as well) + # - pgsql # Note: This is done separately in tools (to check ARCH as well) + + +# ------------------------------------------------------------------------------------------------- +# Software to install (in defined order) +# ------------------------------------------------------------------------------------------------- +base_software_enabled: + - dig # required by Devilbox Intranet + - netcat # required by Devilbox Intranet + - ping # required by Devilbox Intranet + - sudo # required by /etc/sudoers.d/devilbox config file + - blackfire + - mhsendmail + - mongo_client + - mysqldumpsecure + - pgsql_client + + +# ------------------------------------------------------------------------------------------------- +# Apt repository definition +# ------------------------------------------------------------------------------------------------- + +# 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 +# +base_apt_repositories_available: + + ### + ### Backports + ### + backports: + # [Bullseye] + all: + type: repo + pre: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 + deb: deb http://ftp.debian.org/debian {{ os_release['all'].debian }}-backports main + # [Buster] + 7.2: + type: repo + pre: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 + deb: deb http://ftp.debian.org/debian {{ os_release[7.2].debian }}-backports main + # [Buster] + 7.1: + type: repo + pre: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 + deb: deb http://ftp.debian.org/debian {{ os_release[7.1].debian }}-backports main + # [Stretch] + 7.0: + type: repo + pre: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 + deb: deb http://ftp.debian.org/debian {{ os_release[7.0].debian }}-backports main + # [Stretch] + 5.6: + type: repo + pre: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 + deb: deb http://ftp.debian.org/debian {{ os_release[5.6].debian }}-backports main + # [Jessie] + 5.5: + type: repo + pre: echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until + deb: deb [trusted=yes] http://archive.debian.org/debian {{ os_release[5.5].debian }}-backports main + # [Jessie] + 5.4: + type: repo + pre: echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until + deb: deb [trusted=yes] http://archive.debian.org/debian {{ os_release[5.4].debian }}-backports main + # [Jessie] + 5.3: + type: repo + pre: echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until + deb: deb [trusted=yes] http://archive.debian.org/debian {{ os_release[5.3].debian }}-backports main + # [Jessie] + 5.2: + type: repo + pre: echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until + deb: deb [trusted=yes] http://archive.debian.org/debian {{ os_release[5.2].debian }}-backports main + + ### + ### Blackfire + ### + blackfire: + all: + type: repo + deb: deb http://packages.blackfire.io/debian any main + pre: curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - + + ### + ### MongoDB (currently obsolete) + ### + mongo: + # 8.2: mongodb-org-(tools|shell) (amd64, arm64) + # 8.1: mongodb-org-(tools|shell) (amd64, arm64) + # 8.0: mongodb-org-(tools|shell) (amd64, arm64) + # 7.4: mongodb-org-(tools|shell) (amd64, arm64) + # 7.3: mongodb-org-(tools|shell) (amd64, arm64) + # 7.2: mongo-tools OR mongodb-org-(tools|shell) (amd64, arm64) + # 7.1: mongo-tools OR mongodb-org-(tools|shell) (amd64, arm64) + # 7.0: mongodb-clients & mongo-tools (amd64, arm64) + # 5.6: mongodb-clients & mongo-tools (amd64, arm64) + # 5.5: mongodb-clients (amd64) + # 5.4: mongodb-clients (amd64) + # 5.3: mongodb-clients (amd64) + # 5.2: mongodb-clients (amd64) + disabled: [5.2, 5.3, 5.4, 5.5, 5.6, 7.0] # TODO: Why were those disabled? + # [Bullseye] Ubuntu repository required for arm64 support instead + all: + type: repo + # gpg --dry-run --with-fingerprint < <(curl https://www.mongodb.org/static/pgp/server-4.4.asc) | grep fingerprint | sed 's/.*=//g' | sed 's/ //g' + deb: deb http://repo.mongodb.org/apt/ubuntu {{ os_release['all'].ubuntu }}/mongodb-org/4.4 multiverse + key: 20691EEC35216C63CAF66CE1656408E390CFB1F5 + # [Buster] Ubuntu repository required for arm64 support instead + 7.2: + type: repo + # gpg --dry-run --with-fingerprint < <(curl https://www.mongodb.org/static/pgp/server-4.4.asc) | grep fingerprint | sed 's/.*=//g' | sed 's/ //g' + deb: deb http://repo.mongodb.org/apt/ubuntu {{ os_release[7.2].ubuntu }}/mongodb-org/4.4 multiverse + key: 20691EEC35216C63CAF66CE1656408E390CFB1F5 + # [Buster] Ubuntu repository required for arm64 support instead + 7.1: + type: repo + # gpg --dry-run --with-fingerprint < <(curl https://www.mongodb.org/static/pgp/server-4.4.asc) | grep fingerprint | sed 's/.*=//g' | sed 's/ //g' + deb: deb http://repo.mongodb.org/apt/ubuntu {{ os_release[7.1].ubuntu }}/mongodb-org/4.4 multiverse + key: 20691EEC35216C63CAF66CE1656408E390CFB1F5 + + ### + ### PostgrSQL (currently obsolete) + ### + pgsql: + # [Bullseye] + all: + type: repo + deb: deb http://apt.postgresql.org/pub/repos/apt/ {{ os_release['all'].debian }}-pgdg main + pre: curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - + # [Buster] + 7.2: + type: repo + deb: deb http://apt.postgresql.org/pub/repos/apt/ {{ os_release[7.2].debian }}-pgdg main + pre: curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - + # [Buster] + 7.1: + type: repo + deb: deb http://apt.postgresql.org/pub/repos/apt/ {{ os_release[7.1].debian }}-pgdg main + pre: curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - + # [Stretch] + 7.0: + type: repo + deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[7.0].debian }}-pgdg main + # [Stretch] + 5.6: + type: repo + deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[5.6].debian }}-pgdg main + # [Jessie] + 5.5: + type: repo + deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[5.5].debian }}-pgdg main + # [Jessie] + 5.4: + type: repo + deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[5.4].debian }}-pgdg main + # [Jessie] + 5.3: + type: repo + deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[5.3].debian }}-pgdg main + # [Jessie] + 5.2: + type: repo + deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[5.2].debian }}-pgdg main + + +# ------------------------------------------------------------------------------------------------- +# Essential Software definition +# ------------------------------------------------------------------------------------------------- + +# 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 +# check: [optional] Include a check command to test if it was installed successfully +# +# all, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4: +# pre: [optional] Run command before 'command:' statement +# command: Command to execute +# post: [optional] Run command after 'command:' statement +# +base_software_available: + + ### + ### dig + ### + dig: + check: dig -v 2>&1 | grep -E '[0-9]\.[0-9]' + all: + type: apt + package: dnsutils + + ### + ### netcat + ### + netcat: + check: nc -h 2>&1 | grep netcat + all: + type: apt + package: netcat-openbsd + + ### + ### ping + ### + ping: + check: ping -V | grep ^ping + all: + type: apt + package: iputils-ping + + ### + ### sudo + ### + sudo: + check: sudo --version | grep -E 'version [0-9]+\.[0-9]+' + all: + type: apt + package: sudo + + ### + ### Blackfire + ### + blackfire: + check: | + blackfire version \ + && blackfire-agent -v \ + all: + type: custom + pre: | + apt-get update \ + command: | + apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + post: rm -rf /var/lib/apt/lists/* + + ### + ### mhsendmail + ### + mhsendmail: + check: mhsendmail -h 2>&1 | grep 'Usage' + all: + type: custom + command: | + DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + + ### + ### MongoDB Command line client + ### + # 8.2: mongodb-org-(tools|shell) (amd64, arm64) + # 8.1: mongodb-org-(tools|shell) (amd64, arm64) + # 8.0: mongodb-org-(tools|shell) (amd64, arm64) + # 7.4: mongodb-org-(tools|shell) (amd64, arm64) + # 7.3: mongodb-org-(tools|shell) (amd64, arm64) + # 7.2: mongodb-org-(tools|shell) (amd64, arm64) + # 7.1: mongodb-org-(tools|shell) (amd64, arm64) + # 7.0: mongodb-clients & mongo-tools (amd64, arm64) + # 5.6: mongodb-clients & mongo-tools (amd64, arm64) + # 5.5: mongodb-clients (amd64) + # 5.4: mongodb-clients (amd64) + # 5.3: mongodb-clients (amd64) + # 5.2: mongodb-clients (amd64) + mongo_client: + check: | + if echo '{{ php_version }}' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '{{ php_version }}' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + all: + type: custom + pre: | + APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ + && echo "deb http://repo.mongodb.org/apt/ubuntu {{ os_release[php_version].ubuntu }}/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ + && apt-get update \ + command: | + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-org-tools \ + mongodb-org-shell \ + post: rm -rf /var/lib/apt/lists/* + build_dep: [libsnappy-dev] # Required to copy libsnappy.so to next stage + 7.0: + type: custom + pre: apt-get update + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients \ + mongo-tools; \ + else \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + 5.6: + type: custom + pre: apt-get update + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients \ + mongo-tools; \ + else \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + 5.5: + type: custom + pre: apt-get update + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + 5.4: + type: custom + pre: apt-get update + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + 5.3: + type: custom + pre: apt-get update + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + 5.2: + type: custom + pre: apt-get update + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + + ### + ### mysqldump-secure + ### + mysqldumpsecure: + check: mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' + all: + type: custom + command: | + 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 \ + + ### + ### PostgrSQL Command line client + ### + # 8.2: (amd64, arm64) + # 8.1: (amd64, arm64) + # 8.0: (amd64, arm64) + # 7.4: (amd64, arm64) + # 7.3: (amd64, arm64) + # 7.2: (amd64, arm64) + # 7.1: (amd64, arm64) + # 7.0: (amd64) + # 5.6: (amd64) + # 5.5: (amd64) + # 5.4: (amd64) + # 5.3: (amd64) + # 5.2: (amd64) + pgsql_client: + check: | + if echo '{{ php_version }}' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + all: + type: custom + pre: | + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://apt.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update \ + command: | + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client \ + post: rm -rf /var/lib/apt/lists/* + 7.0: + type: custom + pre: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + 5.6: + type: custom + pre: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + 5.5: + type: custom + pre: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + 5.4: + type: custom + pre: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + 5.3: + type: custom + pre: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + 5.2: + type: custom + pre: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + command: | + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ diff --git a/.ansible/group_vars/all/work-help.yml b/.ansible/group_vars/all/work-help.yml new file mode 100644 index 0000000..c96984d --- /dev/null +++ b/.ansible/group_vars/all/work-help.yml @@ -0,0 +1,239 @@ +--- +################################################################################################### +# Docker: work (docker stage: help) +################################################################################################### + +# +# This file holds definition for all devibox/php-fpm:x.y-work images +# + + +# ------------------------------------------------------------------------------------------------- +# Global variables +# ------------------------------------------------------------------------------------------------- +composer_home: /usr/local/src/composer +nvm_home: /opt/nvm +node_version: --lts + + +# ------------------------------------------------------------------------------------------------- +# Software to install (in defined order) +# ------------------------------------------------------------------------------------------------- +help_software_enabled: + - composer + - nvm + - pip + + +## ------------------------------------------------------------------------------------------------- +## Software definition +## ------------------------------------------------------------------------------------------------- +# +# 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 +# check: [optional] Include a check command to test if it was installed successfully +# +# all, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4: +# pre: [optional] Run command before 'command:' statement +# command: Command to execute +# post: [optional] Run command after 'command:' statement +# +help_software_available: + + ### + ### Composer + ### + composer: + disabled: [5.2] + check: composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' + all: + type: custom + pre: | + COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.x" \ + command: | + curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + post: | + ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + run_dep: [unzip] # Required for composer to unzip packages + 7.1: + type: custom + pre: | + COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + 7.0: + type: custom + pre: | + COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + 5.6: + type: custom + pre: | + COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + 5.5: + type: custom + pre: | + COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + 5.4: + type: custom + pre: | + COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + 5.3: + type: custom + pre: | + COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + post: | + ln -sf /usr/local/bin/composer-1 /usr/local/bin/composer \ + + ### + ### nvm + ### + nvm: + check: | + su -c '. {{ nvm_home }}/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. {{ nvm_home }}/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. {{ nvm_home }}/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + all: + type: custom + pre: | + NODE_VERSION="{{ node_version }}" \ + command: | + NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p {{ nvm_home }} \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="{{ nvm_home }}" bash \ + \ + && chown -R devilbox:devilbox "{{ nvm_home }}" \ + # Install latest and LTS version and yarn + post: | + su -c ". {{ nvm_home }}/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". {{ nvm_home }}/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". {{ nvm_home }}/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "{{ nvm_home }}/versions/node/$(su -c '. {{ nvm_home }}/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "{{ nvm_home }}/versions/node/$(su -c '. {{ nvm_home }}/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "{{ nvm_home }}/versions/node/$(su -c '. {{ nvm_home }}/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "{{ nvm_home }}/versions/node/$(su -c '. {{ nvm_home }}/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "{{ nvm_home }}/versions/node/$(su -c '. {{ nvm_home }}/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 {{ nvm_home }} \ + && find {{ nvm_home }} -type f -print0 | xargs -n1 -0 chmod go+w \ + && find {{ nvm_home }} -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf {{ nvm_home }}/.cache \ + && rm -rf {{ nvm_home }}/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf {{ nvm_home }}/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + 7.0: + type: custom + pre: | + NODE_VERSION="17" \ + 5.6: + type: custom + pre: | + NODE_VERSION="17" \ + 5.5: + type: custom + pre: | + NODE_VERSION="17" \ + 5.4: + type: custom + pre: | + NODE_VERSION="17" \ + 5.3: + type: custom + pre: | + NODE_VERSION="17" \ + 5.2: + type: custom + pre: | + NODE_VERSION="17" \ + + ### + ### Python pip + ### + pip: + check: pip --version + all: + type: custom + command: | + curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ + # Cleanup + post: | + /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + run_dep: [python3-distutils] + build_dep: [libpython3-dev] + 7.2: + type: custom + command: | + curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + run_dep: [] + build_dep: [libpython-dev] + 7.1: + type: custom + command: | + curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + run_dep: [] + build_dep: [libpython-dev] + 7.0: + type: custom + command: | + curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + run_dep: [] + build_dep: [libpython-dev] + 5.6: + type: custom + command: | + curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + run_dep: [] + build_dep: [libpython-dev] + 5.5: + type: custom + command: | + curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + run_dep: [] + build_dep: [libpython-dev] + 5.4: + type: custom + command: | + curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + run_dep: [] + build_dep: [libpython-dev] + 5.3: + type: custom + run_dep: [] + build_dep: [libpython-dev] + command: | + curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + 5.2: + type: custom + command: | + curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + run_dep: [] + build_dep: [libpython-dev] diff --git a/.ansible/group_vars/all/work.yml b/.ansible/group_vars/all/work.yml index f496555..133826a 100644 --- a/.ansible/group_vars/all/work.yml +++ b/.ansible/group_vars/all/work.yml @@ -1,1423 +1,717 @@ --- -################################################################################################### -# Docker: work -################################################################################################### -# -# This file holds definition for all devibox/php-fpm:x.y-work images -# +# DO NOT ALTER THIS FILE - IT IS AUTOGENERATED. - -### -### Define operating system versions -### -os_release: - # Jessie (Ubuntu: trusty, utopic, vivid, wily) - 5.2: - debian: jessie - ubuntu: trusty - 5.3: - debian: jessie - ubuntu: trusty - 5.4: - debian: jessie - ubuntu: trusty - 5.5: - debian: jessie - ubuntu: trusty - # Strech (Ubuntu: xenial, yakkety, zesty, artful) - 5.6: - debian: stretch - ubuntu: xenial - 7.0: - debian: stretch - ubuntu: xenial - # Buster (Ubuntu: bionic, cosmic, disco, eoan) - 7.1: - debian: buster - ubuntu: bionic - 7.2: - debian: buster - ubuntu: bionic - # Bullseye (Ubuntu: focal, groovy, hirsute, impish) - 7.3: - debian: bullseye - ubuntu: focal - 7.4: - debian: bullseye - ubuntu: focal - 8.0: - debian: bullseye - ubuntu: focal - 8.1: - debian: bullseye - ubuntu: focal - 8.2: - debian: bullseye - ubuntu: focal - all: - debian: bullseye - ubuntu: focal - - -# ------------------------------------------------------------------------------------------------- -# Global variables -# ------------------------------------------------------------------------------------------------- -composer_home: /usr/local/src/composer -nvm_home: /opt/nvm -node_version: --lts - -directory_to_clean: - - .*json - - .ansible - - .cache - - .composer - - .config - - .console - - .drush - - .gem - - .local - - .node - - .npm - - .pm2 - - .subversion - - .v8* - - node_modules - - yarn.lock - - -# ------------------------------------------------------------------------------------------------- -# Apt repositories to enable (in defined order) -# ------------------------------------------------------------------------------------------------- -apt_repositories_enabled: - - backports - - blackfire - #- git - #- mongo - #- pgsql - - -# ------------------------------------------------------------------------------------------------- -# PHP Composer packages to install -# ------------------------------------------------------------------------------------------------- -composer_enabled: +# The following specifies the order in which tools are being installed. +tools_enabled: + - angular-cli - asgardcms - - codeception - - lumen - #- photon - - prestissimo - - -# ------------------------------------------------------------------------------------------------- -# Ruby gem packages to install -# ------------------------------------------------------------------------------------------------- -gem_enabled: - - mixlib_config - - ffi - - rb_inotify - - mdl - - -# ------------------------------------------------------------------------------------------------- -# Node npm packages to install -# ------------------------------------------------------------------------------------------------- -npm_enabled: - - angular_cli - eslint - - grunt - - grunt_cli - - gulp + - git - jsonlint - # https://github.com/Unitech/pm2 - - pm2 - - mdlint - - sass - - stylelint - - vue_cli - - vue_cli_service_global - - webpack - - webpack_cli - - -# ------------------------------------------------------------------------------------------------- -# Python pip packages to install -# ------------------------------------------------------------------------------------------------- -pip_enabled: - #- ansible - - yamllint - - yq - - -# ------------------------------------------------------------------------------------------------- -# Software to install (in defined order) -# ------------------------------------------------------------------------------------------------- -software_enabled: - # Composer, pip and nvm need to be first, others rely on it - - composer - - pip - - nvm - # Required for internal Devilbox connection - - pgsql_client - - mongo_client - # Normal packages start here - - awesomeci + - mdl + - awesome-ci + - codeception - deployer - - drush7 - - drush8 - - drush9 - - drupalconsole - - gitflow - #- homebrew - - laravel + - git-flow + - grunt-cli + - gulp + - jq + - laravel-installer + - laravel-lumen - linkcheck - - mhsendmail - - mysqldumpsecure - - phalcon - - phpcs - - phpcbf + - mdlint + - mupdf-tools + - phalcon-devtools - php-cs-fixer + - phpcbf + - phpcs - phpmd - phpunit - - symfony + - pm2 + - pwncat + - ssh + - rsync + - sass + - shellcheck + - stylelint + - svn + - symfony-cli + - taskfile + - tig + - vim + - vue-cli + - webpack-cli - wkhtmltopdf - - wpcli + - wp-cli + - yamllint + - yq + - zsh -# ------------------------------------------------------------------------------------------------- -# Apt repository definition -# ------------------------------------------------------------------------------------------------- - -# 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 - ### - backports: - # [Jessie] - 5.2: - pre: echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until - deb: deb [trusted=yes] http://archive.debian.org/debian {{ os_release[5.2].debian }}-backports main - # [Jessie] - 5.3: - pre: echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until - deb: deb [trusted=yes] http://archive.debian.org/debian {{ os_release[5.3].debian }}-backports main - # [Jessie] - 5.4: - pre: echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until - deb: deb [trusted=yes] http://archive.debian.org/debian {{ os_release[5.4].debian }}-backports main - # [Jessie] - 5.5: - pre: echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until - deb: deb [trusted=yes] http://archive.debian.org/debian {{ os_release[5.5].debian }}-backports main - # [Stretch] - 5.6: - pre: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 - deb: deb http://ftp.debian.org/debian {{ os_release[5.6].debian }}-backports main - # [Stretch] - 7.0: - pre: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 - deb: deb http://ftp.debian.org/debian {{ os_release[7.0].debian }}-backports main - # [Buster] - 7.1: - pre: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 - deb: deb http://ftp.debian.org/debian {{ os_release[7.1].debian }}-backports main - # [Buster] - 7.2: - pre: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 - deb: deb http://ftp.debian.org/debian {{ os_release[7.2].debian }}-backports main - # [Bullseye] +# The following specifies how tools are being installed. +tools_available: + angular-cli: + disabled: [] + check: ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) all: - pre: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 - deb: deb http://ftp.debian.org/debian {{ os_release['all'].debian }}-backports main - ### - ### Blackfire - ### - blackfire: - all: - deb: deb http://packages.blackfire.io/debian any main - pre: curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - - ### - ### Git (currently obsolete) - ### - git: - 5.2: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[5.2].ubuntu }} main - 5.3: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[5.3].ubuntu }} main - 5.4: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[5.4].ubuntu }} main - 5.5: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[5.5].ubuntu }} main - 5.6: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[5.6].ubuntu }} main - 7.0: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[7.0].ubuntu }} main - 7.1: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[7.1].ubuntu }} main - 7.2: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[7.2].ubuntu }} main - 7.3: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[7.3].ubuntu }} main - 7.4: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[7.4].ubuntu }} main - 8.0: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[8.0].ubuntu }} main - 8.1: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[8.1].ubuntu }} main - 8.2: - deb: deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ os_release[8.2].ubuntu }} main - all: - key: A1715D88E1DF1F24 - ### - ### MongoDB (currently obsolete) - ### - mongo: - # 5.2: mongodb-clients (amd64) - # 5.3: mongodb-clients (amd64) - # 5.4: mongodb-clients (amd64) - # 5.5: mongodb-clients (amd64) - # 5.6: mongodb-clients & mongo-tools (amd64, arm64) - # 7.0: mongodb-clients & mongo-tools (amd64, arm64) - # 7.1: mongo-tools OR mongodb-org-(tools|shell) (amd64, arm64) - # 7.2: mongo-tools OR mongodb-org-(tools|shell) (amd64, arm64) - # 7.3: mongodb-org-(tools|shell) (amd64, arm64) - # 7.4: mongodb-org-(tools|shell) (amd64, arm64) - # 8.0: mongodb-org-(tools|shell) (amd64, arm64) - # 8.1: mongodb-org-(tools|shell) (amd64, arm64) - # 8.2: mongodb-org-(tools|shell) (amd64, arm64) - disabled: [5.2, 5.3, 5.4, 5.5, 5.6, 7.0] - # [Buster] Ubuntu repository required for arm64 support instead - 7.1: - # gpg --dry-run --with-fingerprint < <(curl https://www.mongodb.org/static/pgp/server-4.4.asc) | grep fingerprint | sed 's/.*=//g' | sed 's/ //g' - deb: deb http://repo.mongodb.org/apt/ubuntu {{ os_release[7.1].ubuntu }}/mongodb-org/4.4 multiverse - key: 20691EEC35216C63CAF66CE1656408E390CFB1F5 - # [Buster] Ubuntu repository required for arm64 support instead - 7.2: - # gpg --dry-run --with-fingerprint < <(curl https://www.mongodb.org/static/pgp/server-4.4.asc) | grep fingerprint | sed 's/.*=//g' | sed 's/ //g' - deb: deb http://repo.mongodb.org/apt/ubuntu {{ os_release[7.2].ubuntu }}/mongodb-org/4.4 multiverse - key: 20691EEC35216C63CAF66CE1656408E390CFB1F5 - # [Bullseye] Ubuntu repository required for arm64 support instead - all: - # gpg --dry-run --with-fingerprint < <(curl https://www.mongodb.org/static/pgp/server-4.4.asc) | grep fingerprint | sed 's/.*=//g' | sed 's/ //g' - deb: deb http://repo.mongodb.org/apt/ubuntu {{ os_release['all'].ubuntu }}/mongodb-org/4.4 multiverse - key: 20691EEC35216C63CAF66CE1656408E390CFB1F5 - ### - ### PostgrSQL (currently obsolete) - ### - pgsql: - # [Jessie] - 5.2: - deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[5.2].debian }}-pgdg main - # [Jessie] - 5.3: - deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[5.3].debian }}-pgdg main - # [Jessie] - 5.4: - deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[5.4].debian }}-pgdg main - # [Jessie] - 5.5: - deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[5.5].debian }}-pgdg main - # [Stretch] - 5.6: - deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[5.6].debian }}-pgdg main - # [Stretch] - 7.0: - deb: deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[7.0].debian }}-pgdg main - # [Buster] - 7.1: - deb: deb http://apt.postgresql.org/pub/repos/apt/ {{ os_release[7.1].debian }}-pgdg main - pre: curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - - # [Buster] - 7.2: - deb: deb http://apt.postgresql.org/pub/repos/apt/ {{ os_release[7.2].debian }}-pgdg main - pre: curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - - # [Bullseye] - all: - deb: deb http://apt.postgresql.org/pub/repos/apt/ {{ os_release['all'].debian }}-pgdg main - pre: curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - - - -# ------------------------------------------------------------------------------------------------- -# Composer (PHP) definition -# ------------------------------------------------------------------------------------------------- - -# name: Name of the PHP Composer package -# link: [optional] Name of the binary to symlink to /usr/local/bin -# 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 -# check: [optional] Include a check command to test if it was installed successfully -# version: Composer version: Either '1' or '2' for composer version -# -# all, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4: -# version: [optional] Specific version of Ruby gem -# -composer_available: + type: npm + package: "@angular/cli" + binary: ng + version: + build_dep: [] + run_dep: [] + pre: + post: asgardcms: - disabled: [5.2, 5.3, 5.4, 8.0, 8.1, 8.2] - check: asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' - name: asgardcms/asgardcms-installer - link: asgardcms - version: 2 - codeception: - disabled: [5.2, 5.3, 8.0, 8.1, 8.2] - check: codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' - name: codeception/codeception - link: codecept - version: 2 - lumen: - disabled: [5.2, 5.3, 5.4, 8.0, 8.1, 8.2] - check: lumen --version 2>/dev/null | grep -E '^Lumen Installer\s[0-9][.0-9]+$' - name: laravel/lumen-installer - link: lumen - version: 2 - #photon: - # disabled: [5.2, 5.3, 5.4, 8.0, 8.1, 8.2] - # check: photon --version | grep -E 'Installer [0-9][.0-9]+' - # name: photoncms/installer - # link: photon - # version: 2 - prestissimo: - disabled: [5.2, 8.0, 8.1, 8.2] - name: hirak/prestissimo - version: 1 - - -# ------------------------------------------------------------------------------------------------- -# Gems (Ruby) definition -# ------------------------------------------------------------------------------------------------- - -# name: Name of the Ruby gem package -# 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 -# check: [optional] Include a check command to test if it was installed successfully -# -# all, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4: -# version: [optional] Specific version of Ruby gem -# -gem_available: - mixlib_config: - name: mixlib-config + disabled: [5.2, 5.3, 5.4] + check: asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) all: - version: 2.2.4 - # Required by rb-inotify, as otherwise rb-inotify will pull ffi as a dependency in a - # version which is not supported by the ruby version (>= 2.3) - ffi: - name: ffi - disabled: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2] - all: - version: 1.12.2 - rb_inotify: - name: rb-inotify - all: - version: 0.9.10 - mdl: - name: mdl - check: mdl --version | grep -E '[0-9][.0-9]+' - 8.2: - version: 0.5.0 - 8.1: - version: 0.5.0 - 8.0: - version: 0.5.0 - 7.4: - version: 0.5.0 - 7.3: - version: 0.5.0 - 7.2: - version: 0.5.0 - 7.1: - version: 0.5.0 - 7.0: - version: 0.5.0 - 5.6: - version: 0.5.0 - 5.5: - version: 0.5.0 - 5.4: - version: 0.5.0 - 5.3: - version: 0.5.0 - 5.2: - version: 0.5.0 - - -# ------------------------------------------------------------------------------------------------- -# npm (Node) definition -# ------------------------------------------------------------------------------------------------- - -# name: Name of the Node npm package -# 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 -# check: [optional] Include a check command to test if it was installed successfully -# -# all, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4: -# version: [optional] Specific version of Node npm package -# -npm_available: - angular_cli: - name: "@angular/cli" - check: ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' + type: composer + composer: 2 + package: asgardcms/asgardcms-installer + # https://github.com/AsgardCms/asgardcms-installer/issues/1 + version: dev-master + flags: + binary: asgardcms + build_dep: [] + run_dep: [] + pre: + post: eslint: - name: eslint - check: eslint -v | grep -E '[0-9][.0-9]+' - grunt: - name: grunt - grunt_cli: - name: grunt-cli - check: grunt --version | grep -E '[0-9][.0-9]+' - gulp: - name: gulp - check: gulp --version | grep -E '[0-9][.0-9]+' + disabled: [] + check: eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) + all: + type: npm + package: "eslint" + binary: eslint + version: + build_dep: [] + run_dep: [] + pre: + post: + git: + disabled: [] + check: git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) + all: + type: apt + package: git jsonlint: - name: jsonlint - check: jsonlint --version | grep -E '[0-9][.0-9]+' - pm2: - name: pm2 - check: pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' - mdlint: - name: mdlint - check: mdlint --version | grep -E '[0-9][.0-9]+' - sass: - name: sass - check: sass --version | grep -E '[0-9][.0-9]+' - stylelint: - name: stylelint - check: stylelint --version | grep -E '[0-9][.0-9]+' - vue_cli: - name: "@vue/cli" - check: vue --version | grep -E '[0-9][.0-9]+' - vue_cli_service_global: - name: "@vue/cli-service-global" - webpack: - name: webpack - webpack_cli: - name: webpack-cli - check: webpack --version | grep -E '[0-9][.0-9]+' - - -# ------------------------------------------------------------------------------------------------- -# pip (Python) definition -# ------------------------------------------------------------------------------------------------- - -# name: Name of the Python pip package -# 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 -# check: [optional] Include a check command to test if it was installed successfully -# -# all, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4: -# version: [optional] Specific version of Python pip package -# -pip_available: - ansible: - name: ansible + disabled: [] + check: jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) all: - version: 3.4.0 - check: ansible --version | grep -E '^ansible [0-9][.0-9]+$' - yamllint: - name: yamllint - check: yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' - yq: - name: yq - check: yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' - - -# ------------------------------------------------------------------------------------------------- -# Software definition -# ------------------------------------------------------------------------------------------------- - -# 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 -# check: [optional] Include a check command to test if it was installed successfully -# -# all, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4: -# pre: [optional] Run command before 'command:' statement -# command: Command to execute -# post: [optional] Run command after 'command:' statement -# -software_available: - # Composer is a dependency for others - composer: - disabled: [5.2] - check: composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' - 5.3: - pre: | - COMPOSER_1_VERSION="latest-1.x" \ - && COMPOSER_2_VERSION="latest-2.2.x" \ - post: | - ln -sf /usr/local/bin/composer-1 /usr/local/bin/composer \ - 5.4: - pre: | - COMPOSER_1_VERSION="latest-1.x" \ - && COMPOSER_2_VERSION="latest-2.2.x" \ - 5.5: - pre: | - COMPOSER_1_VERSION="latest-1.x" \ - && COMPOSER_2_VERSION="latest-2.2.x" \ - 5.6: - pre: | - COMPOSER_1_VERSION="latest-1.x" \ - && COMPOSER_2_VERSION="latest-2.2.x" \ - 7.0: - pre: | - COMPOSER_1_VERSION="latest-1.x" \ - && COMPOSER_2_VERSION="latest-2.2.x" \ - 7.1: - pre: | - COMPOSER_1_VERSION="latest-1.x" \ - && COMPOSER_2_VERSION="latest-2.2.x" \ + type: npm + package: jsonlint + binary: jsonlint + version: + build_dep: [] + run_dep: [] + pre: + post: + mdl: + disabled: [] + check: mdl --version | grep -E '[.0-9]+' || (mdl --version; false) all: - pre: | - COMPOSER_1_VERSION="latest-1.x" \ - && COMPOSER_2_VERSION="latest-2.x" \ - command: | - curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ - && chmod +x /usr/local/bin/composer-1 \ - && chmod +x /usr/local/bin/composer-2 \ - post: | - ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - # pip is a dependency for others - pip: - 5.2: - command: | - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ - && DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ - \ - && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - 5.3: - command: | - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ - && DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ - \ - && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - 5.4: - command: | - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ - && DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ - \ - && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - 5.5: - command: | - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ - && DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ - \ - && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - 5.6: - command: | - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ - && DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ - \ - && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - 7.0: - command: | - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ - && DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ - \ - && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - 7.1: - command: | - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ - && DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ - \ - && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + type: rubygem + package: mdl + # version: + build_dep: [ruby-dev] + run_dep: [ruby] + # pre: + # post: 7.2: - command: | - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ - && DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ - \ - && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - all: - command: | - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython3-dev \ - python3-distutils \ - && DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ - \ - && curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ - # nvm is a dependency for others - nvm: - check: | - su -c '. {{ nvm_home }}/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - && su -c '. {{ nvm_home }}/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - 5.2: + type: rubygem + version: 0.11.0 pre: | - NODE_VERSION="17" \ - 5.3: + gem install chef-utils -v 16.6.14 \ + 7.1: + type: rubygem + version: 0.11.0 pre: | - NODE_VERSION="17" \ - 5.4: - pre: | - NODE_VERSION="17" \ - 5.5: - pre: | - NODE_VERSION="17" \ - 5.6: - pre: | - NODE_VERSION="17" \ + gem install chef-utils -v 16.6.14 \ 7.0: + type: rubygem + version: 0.5.0 pre: | - NODE_VERSION="17" \ - all: - pre: | - NODE_VERSION="{{ node_version }}" \ - command: | - NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ - )" \ - && mkdir -p {{ nvm_home }} \ - && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="{{ nvm_home }}" bash \ - \ - && { \ - echo 'export NVM_DIR="{{ nvm_home }}"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ - } >> /home/devilbox/.bashrc \ - \ - && chown -R devilbox:devilbox "{{ nvm_home }}" \ - # Install latest and LTS version and yarn - post: | - su -c ". {{ nvm_home }}/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ - && su -c ". {{ nvm_home }}/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ - && su -c ". {{ nvm_home }}/nvm.sh; corepack enable" devilbox \ - \ - && chmod 0777 {{ nvm_home }} \ - && find {{ nvm_home }} -type f -print0 | xargs -n1 -0 chmod go+w \ - && find {{ nvm_home }} -type d -print0 | xargs -n1 -0 chmod 0777 \ - ### - ### PostgrSQL Command line client - ### - # 5.2: (amd64) - # 5.3: (amd64) - # 5.4: (amd64) - # 5.5: (amd64) - # 5.6: (amd64) - # 7.0: (amd64) - # 7.1: (amd64, arm64) - # 7.2: (amd64, arm64) - # 7.3: (amd64, arm64) - # 7.4: (amd64, arm64) - # 8.0: (amd64, arm64) - # 8.1: (amd64, arm64) - # 8.2: (amd64, arm64) - pgsql_client: - check: | - if echo '{{ php_version }}' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ - else \ - pg_isready --version; \ - fi \ - 5.2: - pre: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ - fi \ - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ - fi \ - 5.3: - pre: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ - fi \ - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ - fi \ - 5.4: - pre: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ - fi \ - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ - fi \ - 5.5: - pre: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ - fi \ - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ - fi \ + gem install mixlib-config -v 2.2.4 \ 5.6: + type: rubygem + version: 0.5.0 pre: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ - fi \ - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ - fi \ - 7.0: - pre: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ - fi \ - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ - fi \ - all: - pre: | - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://apt.postgresql.org/pub/repos/apt/ {{ os_release[php_version].debian }}-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update \ - command: | - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client \ - post: rm -rf /var/lib/apt/lists/* - ### - ### MongoDB Command line client - ### - # 5.2: mongodb-clients (amd64) - # 5.3: mongodb-clients (amd64) - # 5.4: mongodb-clients (amd64) - # 5.5: mongodb-clients (amd64) - # 5.6: mongodb-clients & mongo-tools (amd64, arm64) - # 7.0: mongodb-clients & mongo-tools (amd64, arm64) - # 7.1: mongodb-org-(tools|shell) (amd64, arm64) - # 7.2: mongodb-org-(tools|shell) (amd64, arm64) - # 7.3: mongodb-org-(tools|shell) (amd64, arm64) - # 7.4: mongodb-org-(tools|shell) (amd64, arm64) - # 8.0: mongodb-org-(tools|shell) (amd64, arm64) - # 8.1: mongodb-org-(tools|shell) (amd64, arm64) - # 8.2: mongodb-org-(tools|shell) (amd64, arm64) - mongo_client: - check: | - if echo '{{ php_version }}' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ - else \ - mongofiles --version; \ - fi \ - 5.2: - pre: apt-get update - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ - fi \ - 5.3: - pre: apt-get update - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ - fi \ - 5.4: - pre: apt-get update - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ - fi \ + gem install mixlib-config -v 2.2.4 \ 5.5: - pre: apt-get update - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ - fi \ - 5.6: - pre: apt-get update - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients \ - mongo-tools; \ - else \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ - fi \ - 7.0: - pre: apt-get update - command: | - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients \ - mongo-tools; \ - else \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ - fi \ - all: + type: rubygem + version: 0.5.0 pre: | - APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ - && echo "deb http://repo.mongodb.org/apt/ubuntu {{ os_release[php_version].ubuntu }}/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ - && apt-get update \ - command: | - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-org-tools \ - mongodb-org-shell \ - post: rm -rf /var/lib/apt/lists/* - awesomeci: - check: regex-grep --version | grep -E '[0-9][.0-9]+' + gem install mixlib-config -v 2.2.4 \ + 5.4: + type: rubygem + version: 0.5.0 + pre: | + gem install mixlib-config -v 2.2.4 \ + 5.3: + type: rubygem + version: 0.5.0 + pre: | + gem install mixlib-config -v 2.2.4 \ + 5.2: + type: rubygem + version: 0.5.0 + pre: | + gem install mixlib-config -v 2.2.4 \ + awesome-ci: + disabled: [] + check: regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) all: + type: custom command: | - git clone https://github.com/cytopia/awesome-ci.git /usr/local/src/awesome-ci \ - && cd /usr/local/src/awesome-ci \ + git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ && git checkout $(git describe --abbrev=0 --tags) \ && ./configure --prefix=/usr/local \ && make install \ && cd / \ - && rm -rf /usr/local/src/awesome-ci \ + && rm -rf /tmp/awesome-ci \ + # moreutils: isutf8 + run_dep: [dos2unix, file, moreutils] + codeception: + disabled: [5.2, 5.3] + check: codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) + all: + type: composer + composer: 2 + package: codeception/codeception + # version: + flags: + binary: codecept + build_dep: [] + run_dep: [] + # pre: + # post: deployer: disabled: [5.2, 5.3] - check: dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' - 5.4: - command: curl -sS -k -L --fail https://deployer.org/releases/v3.3.0/deployer.phar -L -o /usr/local/bin/dep - post: chmod +x /usr/local/bin/dep - 5.5: - command: curl -sS -k -L --fail https://deployer.org/releases/v4.3.4/deployer.phar -L -o /usr/local/bin/dep - post: chmod +x /usr/local/bin/dep - 5.6: - command: curl -sS -k -L --fail https://deployer.org/releases/v4.3.4/deployer.phar -L -o /usr/local/bin/dep - post: chmod +x /usr/local/bin/dep - 7.0: - command: curl -sS -k -L --fail https://deployer.org/releases/v6.7.0/deployer.phar -L -o /usr/local/bin/dep - post: chmod +x /usr/local/bin/dep - 7.1: - command: curl -sS -k -L --fail https://deployer.org/releases/v6.7.0/deployer.phar -L -o /usr/local/bin/dep - post: chmod +x /usr/local/bin/dep + check: dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) all: + type: custom command: curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep post: chmod +x /usr/local/bin/dep - drush7: - disabled: [5.2, 8.0, 8.1, 8.2] - check: drush7 --version | grep -E '7[.0-9]+\s*$' - all: - pre: | - git clone https://github.com/drush-ops/drush.git /usr/local/src/drush7 \ - && cd /usr/local/src/drush7 \ - && git checkout 7.4.0 \ - command: | - chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush7 \ - && su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush7 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ - && ln -s /usr/local/src/drush7/drush /usr/local/bin/drush7 \ - && rm -rf /usr/local/src/drush7/.git \ - && rm -rf /usr/local/src/drush7/docs \ - && rm -rf /usr/local/src/drush7/examples \ - && rm -rf /usr/local/src/drush7/misc \ - drush8: - disabled: [5.2, 5.3, 8.0, 8.1, 8.2] - check: drush8 --version | grep -E '8[.0-9]+\s*$' - all: - pre: | - git clone https://github.com/drush-ops/drush.git /usr/local/src/drush8 \ - && cd /usr/local/src/drush8 \ - && git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/8[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - command: | - chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush8 \ - && su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush8 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ - && ln -s /usr/local/src/drush8/drush /usr/local/bin/drush8 \ - && rm -rf /usr/local/src/drush8/.git \ - && rm -rf /usr/local/src/drush8/docs \ - && rm -rf /usr/local/src/drush8/examples \ - && rm -rf /usr/local/src/drush8/misc \ - drush9: - disabled: [5.2, 5.3, 5.4, 5.5, 7.0, 7.1, 8.0, 8.1, 8.2] - check: drush9 --version | grep -E '9[.0-9]+\s*$' - all: - pre: | - git clone https://github.com/drush-ops/drush.git /usr/local/src/drush9 \ - && cd /usr/local/src/drush9 \ - && git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/9[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - command: | - chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush9 \ - && su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush9 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress' \ - && ln -s /usr/local/src/drush9/drush /usr/local/bin/drush9 \ - && rm -rf /usr/local/src/drush9/.git \ - && rm -rf /usr/local/src/drush9/docs \ - && rm -rf /usr/local/src/drush9/examples \ - && rm -rf /usr/local/src/drush9/misc \ - drupalconsole: - disabled: [5.2, 5.3, 5.4, 7.0, 7.1, 8.0, 8.1, 8.2] # TODO: re-enable for 8.0 (currently errors) - check: drupal --version | grep -E 'Drupal Console Launcher\s*[0-9][.0-9]' - 5.5: - pre: DURL="https://github.com/hechoendrupal/drupal-console-launcher/releases/download/1.9.4/drupal.phar" - 5.6: - pre: DURL="https://github.com/hechoendrupal/drupal-console-launcher/releases/download/1.9.4/drupal.phar" - 7.0: - pre: DURL="https://github.com/hechoendrupal/drupal-console-launcher/releases/download/1.9.4/drupal.phar" 7.1: - pre: DURL="https://github.com/hechoendrupal/drupal-console-launcher/releases/download/1.9.4/drupal.phar" - all: - pre: DURL="$(curl -s https://api.github.com/repos/hechoendrupal/drupal-console-launcher/releases/latest | awk -F\" '/download.*.phar/{print $(NF-1)}' | head -1)" - command: curl -sS -L --fail "${DURL}" -L -o /usr/local/bin/drupal - post: chmod +x /usr/local/bin/drupal - gitflow: - check: git-flow version | grep -E '[0-9][.0-9]+' + type: custom + command: curl -sS -k -L --fail https://deployer.org/releases/v6.7.0/deployer.phar -L -o /usr/local/bin/dep + 7.0: + type: custom + command: curl -sS -k -L --fail https://deployer.org/releases/v6.7.0/deployer.phar -L -o /usr/local/bin/dep + 5.6: + type: custom + command: curl -sS -k -L --fail https://deployer.org/releases/v4.3.4/deployer.phar -L -o /usr/local/bin/dep + 5.5: + type: custom + command: curl -sS -k -L --fail https://deployer.org/releases/v4.3.4/deployer.phar -L -o /usr/local/bin/dep + 5.4: + type: custom + command: curl -sS -k -L --fail https://deployer.org/releases/v3.3.0/deployer.phar -L -o /usr/local/bin/dep + git-flow: + disabled: [] + check: git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) all: + type: custom command: | git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ && cd /tmp/gitflow \ && make install \ && cd / && rm -rf /tmp/gitflow \ - homebrew: + grunt-cli: + disabled: [] + check: grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) all: - command: | - git clone https://github.com/Homebrew/brew.git /usr/local/src/brew \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/brew \ - && v="${BASH_PROFILE}" su ${MY_USER} -c -p \ - 'echo "PATH=/usr/local/src/brew/bin:/usr/local/src/brew/sbin:/usr/bin:/usr/sbin:/bin:/sbin" >> /home/devilbox/${v}' \ - && v="${BASH_PROFILE}" su ${MY_USER} -c -p \ - 'echo "export MANPATH=/usr/local/src/brew/manpages:${MANPATH}" >> /home/devilbox/${v}' \ - && v="${BASH_PROFILE}" su ${MY_USER} -c -p \ - 'echo "export INFOPATH=/usr/local/src/brew/manpages:${INFOPATH}" >> /home/devilbox/${v}' \ - && su - ${MY_USER} -c '/usr/local/src/brew/bin/brew config' \ - laravel: - check: laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' - disabled: [5.2, 5.3, 8.2] - 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 \ + type: npm + package: "grunt-cli" + binary: grunt + version: + build_dep: [] + run_dep: [] + pre: post: - ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel - 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 \ + gulp: + disabled: [] + check: gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) + all: + type: npm + package: gulp + binary: gulp + version: + build_dep: [] + run_dep: [] + pre: post: - ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel - 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 \ - post: - ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel - 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 \ - post: - ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel - 7.1: - pre: | - git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \ - && cd /usr/local/src/laravel-installer \ - && git checkout $(git tag | grep '^v2\.3\.' | sort -u | tail -1) \ - post: - ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel + jq: + disabled: [] + check: jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) + all: + type: apt + package: jq + laravel-installer: + disabled: [5.2, 5.3] + check: laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) + all: + type: composer + composer: 2 + package: laravel/installer + # version: + flags: + binary: bin/laravel + build_dep: [] + run_dep: [] 7.2: - pre: | - git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \ - && cd /usr/local/src/laravel-installer \ - && git checkout v4.0.0 \ - post: - ln -s /usr/local/src/laravel-installer/bin/laravel /usr/local/bin/laravel - 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ - && rm -rf /usr/local/src/laravel-installer/laravel/.git \ - post: - ln -s /usr/local/src/laravel-installer/bin/laravel /usr/local/bin/laravel - linkcheck: - check: linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' - all: - command: | - curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ - && chmod +x /usr/local/bin/linkcheck \ - mhsendmail: - all: - command: | - if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ - fi \ - mysqldumpsecure: - check: mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' - all: - command: | - 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 \ - phalcon: - disabled: [5.2, 7.4, 8.0, 8.1, 8.2] - check: phalcon commands | grep -E '[0-9][.0-9]+' - 5.3: - pre: | - git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ - && cd /usr/local/src/phalcon-devtools \ - && git checkout v2.0.7 \ - 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 \ - 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 \ - 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 -sf /usr/local/src/phalcon-devtools/phalcon.php /usr/local/bin/phalcon \ - && cd / \ - && rm -rf /usr/local/src/phalcon-devtools/.git \ - 5.5: - pre: | - git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ - && cd /usr/local/src/phalcon-devtools \ - && git checkout v3.4.11 \ - 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 -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ - && chmod +x /usr/local/bin/phalcon \ - && cd / \ - && rm -rf /usr/local/src/phalcon-devtools/.git \ - 5.6: - pre: | - git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ - && cd /usr/local/src/phalcon-devtools \ - && git checkout v3.4.11 \ - 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 -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ - && chmod +x /usr/local/bin/phalcon \ - && cd / \ - && rm -rf /usr/local/src/phalcon-devtools/.git \ - 7.0: - pre: | - git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ - && cd /usr/local/src/phalcon-devtools \ - && git checkout v3.4.11 \ - 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 -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ - && chmod +x /usr/local/bin/phalcon \ - && cd / \ - && rm -rf /usr/local/src/phalcon-devtools/.git \ + type: composer + version: 4.0.0 7.1: + type: composer + binary: laravel + version: 2.3.0 + 7.0: + type: composer + binary: laravel + version: 2.2.0 + 5.6: + type: composer + binary: laravel + version: 2.2.0 + 5.5: + type: composer + binary: laravel + version: 2.2.0 + 5.4: + type: composer + binary: laravel + version: 1.3.7 + laravel-lumen: + disabled: [5.2, 5.3, 5.4] + check: lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) + all: + type: composer + composer: 2 + package: laravel/lumen-installer + # version: + flags: + binary: lumen + build_dep: [] + run_dep: [] + # pre: + # post: + linkcheck: + disabled: [] + check: linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) + all: + type: custom + command: curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck + post: chmod +x /usr/local/bin/linkcheck + build_dep: [] + run_dep: [] + mdlint: + disabled: [] + check: mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) + all: + type: npm + package: mdlint + binary: mdlint + version: + build_dep: [] + run_dep: [] + pre: + post: + mupdf-tools: + disabled: [] + check: | + PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + all: + type: apt + package: mupdf-tools + phalcon-devtools: + disabled: [5.2, 5.3, 5.4, 8.2] + check: | + if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + all: + type: composer + composer: 2 + package: phalcon/devtools + binary: phalcon + # Enable phalcon.so (and its requirement psr prior installing) pre: | - git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ - && cd /usr/local/src/phalcon-devtools \ - && git checkout v3.4.11 \ - 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 -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ - && chmod +x /usr/local/bin/phalcon \ - && cd / \ - && rm -rf /usr/local/src/phalcon-devtools/.git \ - 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) \ - && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer install \ - 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 -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ - && chmod +x phalcon \ - && cd / \ - && rm -rf /usr/local/src/phalcon-devtools/.git \ - phpcs: - check: phpcs --version | grep -E 'version [0-9][.0-9]+' - 5.2: - command: | - curl -sS -L --fail https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcs.phar > /usr/local/bin/phpcs \ - && chmod +x /usr/local/bin/phpcs \ - 5.3: - command: | - curl -sS -L --fail https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcs.phar > /usr/local/bin/phpcs \ - && chmod +x /usr/local/bin/phpcs \ - all: - command: | - curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ - && chmod +x /usr/local/bin/phpcs \ - phpcbf: - check: phpcbf --version | grep -E 'version [0-9][.0-9]+' - 5.2: - command: | - curl -sS -L --fail https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcbf.phar > /usr/local/bin/phpcbf \ - && chmod +x /usr/local/bin/phpcbf \ - 5.3: - command: | - curl -sS -L --fail https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcbf.phar > /usr/local/bin/phpcbf \ - && chmod +x /usr/local/bin/phpcbf \ - all: - command: | - curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ - && chmod +x /usr/local/bin/phpcbf \ + if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + # Disable phalcon.so (and its requirement psr after installing) + post: | + if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + 7.1: + type: composer + version: 3.4.11 + 7.0: + type: composer + version: 3.4.11 + 5.6: + type: composer + version: 3.4.11 + 5.5: + type: composer + version: 3.4.11 php-cs-fixer: disabled: [5.2, 8.2] - check: php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' - 5.3: - command: | - curl -sS -k -L --fail https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar > /usr/local/bin/php-cs-fixer \ - && chmod +x /usr/local/bin/php-cs-fixer \ - 5.4: - command: | - curl -sS -k -L --fail https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar > /usr/local/bin/php-cs-fixer \ - && chmod +x /usr/local/bin/php-cs-fixer \ - 5.5: - command: | - curl -sS -k -L --fail https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar > /usr/local/bin/php-cs-fixer \ - && chmod +x /usr/local/bin/php-cs-fixer \ - 5.6: - command: | - curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer \ - && chmod +x /usr/local/bin/php-cs-fixer \ - 7.0: - command: | - curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer \ - && chmod +x /usr/local/bin/php-cs-fixer \ - 7.1: - command: | - curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer \ - && chmod +x /usr/local/bin/php-cs-fixer \ - 7.2: - command: | - curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer \ - && chmod +x /usr/local/bin/php-cs-fixer \ - 7.3: - command: | - curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer \ - && chmod +x /usr/local/bin/php-cs-fixer \ + check: php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) all: - command: | - curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v3.phar > /usr/local/bin/php-cs-fixer \ - && chmod +x /usr/local/bin/php-cs-fixer \ + type: custom + command: curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v3.phar" + post: chmod +x /usr/local/bin/php-cs-fixer + 7.3: + type: custom + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" + 7.2: + type: custom + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" + 7.1: + type: custom + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" + 7.0: + type: custom + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" + 5.6: + type: custom + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" + 5.5: + type: custom + pre: PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar" + 5.4: + type: custom + pre: PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar" + 5.3: + type: custom + pre: PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar" + phpcbf: + disabled: [] + check: phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) + all: + type: custom + command: curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf + pre: PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" + post: chmod +x /usr/local/bin/phpcbf + 5.3: + type: custom + pre: PHPCBF_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcbf.phar" + 5.2: + type: custom + pre: PHPCBF_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcbf.phar" + phpcs: + disabled: [] + check: phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) + all: + type: custom + command: curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs + pre: PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" + post: chmod +x /usr/local/bin/phpcs + 5.3: + type: custom + pre: PHPCS_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcs.phar" + 5.2: + type: custom + pre: PHPCS_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcs.phar" phpmd: disabled: [5.2] - check: phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' + check: phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) all: - command: | - curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ - && mv phpmd.phar /usr/local/bin/phpmd \ - && chmod +x /usr/local/bin/phpmd \ + type: custom + command: curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd + post: chmod +x /usr/local/bin/phpmd phpunit: - disabled: [5.2, 8.0, 8.1, 8.2] - check: phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' - 5.3: - command: | - curl -sS -k -L --fail https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit \ - && chmod +x /usr/local/bin/phpunit \ - 5.4: - command: | - curl -sS -k -L --fail https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit \ - && chmod +x /usr/local/bin/phpunit \ - 5.5: - command: | - curl -sS -k -L --fail https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit \ - && chmod +x /usr/local/bin/phpunit \ - 5.6: - command: | - curl -sS -k -L --fail https://phar.phpunit.de/phpunit-5.phar > /usr/local/bin/phpunit \ - && chmod +x /usr/local/bin/phpunit \ - 7.0: - command: | - curl -sS -k -L --fail https://phar.phpunit.de/phpunit-6.phar > /usr/local/bin/phpunit \ - && chmod +x /usr/local/bin/phpunit \ - all: - command: | - curl -sS -k -L --fail https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit \ - && chmod +x /usr/local/bin/phpunit \ - symfony: - disabled: [5.2, 5.3] - check: symfony -V | grep -Ei 'version\s[0-9][.0-9]+' - all: - pre: VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" - command: | - curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ - && dpkg -i /tmp/symfonycli.deb \ - && rm -f /tmp/symfonycli.deb \ - wkhtmltopdf: - check: if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi - 5.2: - pre: VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/wkhtmltopdf/releases | awk -F\" '/wkhtmltopdf.*.jessie_amd64\.deb/{print $(NF-1)}' | head -1 )" - command: | - if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ - fi \ - 5.3: - pre: VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/wkhtmltopdf/releases | awk -F\" '/wkhtmltopdf.*.jessie_amd64\.deb/{print $(NF-1)}' | head -1 )" - command: | - if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ - fi \ - 5.4: - pre: VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/wkhtmltopdf/releases | awk -F\" '/wkhtmltopdf.*.jessie_amd64\.deb/{print $(NF-1)}' | head -1 )" - command: | - if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ - fi \ - 5.5: - pre: VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/wkhtmltopdf/releases | awk -F\" '/wkhtmltopdf.*.jessie_amd64\.deb/{print $(NF-1)}' | head -1 )" - command: | - if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ - fi \ - 5.6: - command: | - if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ - fi \ - 7.0: - command: | - if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ - fi \ - all: - pre: VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases | awk -F\" '/wkhtmltopdf.*.stretch_amd64\.deb/{print $(NF-1)}' | head -1 )" - command: | - if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont2 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ - fi \ - post: | - if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ - fi \ - wpcli: disabled: [5.2] - check: wp --allow-root --version | grep -E '[0-9][.0-9]+' - 5.3: - command: curl -sS -L --fail https://github.com/wp-cli/wp-cli/releases/download/v1.5.1/wp-cli-1.5.1.phar -L -o /usr/local/bin/wp - post: chmod +x /usr/local/bin/wp + check: phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) + all: + type: custom + command: | + if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + build_dep: [] + run_dep: [] + pre: PHP_UNIT_VERSION="" + post: chmod +x /usr/local/bin/phpunit + 7.2: + type: custom + pre: PHP_UNIT_VERSION="8" + 7.1: + type: custom + pre: PHP_UNIT_VERSION="7" + 7.0: + type: custom + pre: PHP_UNIT_VERSION="6" + 5.6: + type: custom + pre: PHP_UNIT_VERSION="5" + 5.5: + type: custom + pre: PHP_UNIT_VERSION="4" 5.4: - command: curl -sS -L --fail https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar -L -o /usr/local/bin/wp + type: custom + pre: PHP_UNIT_VERSION="4" + 5.3: + type: custom + pre: PHP_UNIT_VERSION="4" + pm2: + disabled: [] + check: pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) + all: + type: npm + package: pm2 + binary: pm2 + version: + build_dep: [] + run_dep: [] + pre: + post: + pwncat: + disabled: [] + check: pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) + all: + type: pip + version: + build_dep: [] + run_dep: [] + pre: + post: | + ln -s pwncat /usr/local/bin/netcat \ + ssh: + disabled: [] + check: ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) + all: + type: apt + package: openssh-client + rsync: + disabled: [] + check: rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) + all: + type: apt + package: rsync + sass: + disabled: [] + check: sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) + all: + type: npm + package: sass + binary: sass + version: + build_dep: [] + run_dep: [] + pre: + post: + shellcheck: + disabled: [] + check: shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) + all: + type: apt + package: shellcheck + stylelint: + disabled: [] + check: stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) + all: + type: npm + package: stylelint + binary: stylelint + version: + build_dep: [] + run_dep: [] + pre: + post: + svn: + disabled: [] + check: svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) + all: + type: apt + package: subversion + symfony-cli: + disabled: [] + check: symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) + all: + type: custom + command: curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin + build_dep: [] + run_dep: [] + taskfile: + disabled: [] + check: task --version | grep -E '[0-9][.0-9]+' || (task --version; false) + all: + type: custom + command: sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ + tig: + disabled: [] + check: tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) + all: + type: apt + package: tig + vim: + disabled: [] + check: vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) + all: + type: apt + package: vim + vue-cli: + disabled: [] + check: vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) + all: + type: npm + package: "@vue/cli" + binary: vue + version: + build_dep: [] + run_dep: [] + pre: + post: + webpack-cli: + disabled: [] + check: webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) + all: + type: npm + package: webpack-cli + binary: webpack-cli + version: + build_dep: [] + run_dep: [] + pre: + post: + wkhtmltopdf: + disabled: [5.2, 5.3, 5.4, 5.5] + check: wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) + all: + type: custom + pre: OS_RELEASE="bullseye" + command: | + DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + run_dep: + - fontconfig + - libfontenc1 + - libxfont2 + - libxrender1 + - xfonts-75dpi + - xfonts-base + - xfonts-encodings + - xfonts-utils + 7.2: + type: custom + pre: OS_RELEASE="buster" + 7.1: + type: custom + pre: OS_RELEASE="buster" + 7.0: + type: custom + pre: OS_RELEASE="stretch" + run_dep: + - fontconfig + - libfontenc1 + - libxfont1 + - libxrender1 + - xfonts-75dpi + - xfonts-base + - xfonts-encodings + - xfonts-utils + 5.6: + type: custom + pre: OS_RELEASE="stretch" + run_dep: + - fontconfig + - libfontenc1 + - libxfont1 + - libxrender1 + - xfonts-75dpi + - xfonts-base + - xfonts-encodings + - xfonts-utils + wp-cli: + disabled: [5.2] + check: wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) + all: + type: custom + command: curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp + build_dep: [] + run_dep: [] + pre: WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" post: chmod +x /usr/local/bin/wp 5.5: - command: curl -sS -L --fail https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar -L -o /usr/local/bin/wp - post: chmod +x /usr/local/bin/wp + type: custom + pre: WPCLI_URL="https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar" + 5.4: + type: custom + pre: WPCLI_URL="https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar" + 5.3: + type: custom + pre: WPCLI_URL="https://github.com/wp-cli/wp-cli/releases/download/v1.5.1/wp-cli-1.5.1.phar" + yamllint: + disabled: [] + check: yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) all: - command: curl -sS -L --fail 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 + type: pip + version: + build_dep: [] + run_dep: [] + # pre: + # post: + yq: + disabled: [] + check: yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) + all: + type: pip + version: + build_dep: [] + run_dep: [] + pre: + post: + zsh: + disabled: [] + check: zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) + all: + type: apt + package: zsh diff --git a/.ansible/jinja2/macros-work.j2 b/.ansible/jinja2/macros-work.j2 new file mode 100644 index 0000000..810674c --- /dev/null +++ b/.ansible/jinja2/macros-work.j2 @@ -0,0 +1,283 @@ +{################################################################################################## +# IMPORTS +##################################################################################################} +{% import './jinja2/macros.j2' as fn %} + + + +{################################################################################################## +# GENERIC MACROS +##################################################################################################} + +{#- +### +### Check if not disabled +### +### Returns 'true' string if not disabled, otherwise returns nothing +### +-#} +{%- macro is_not_disabled(php, name, items) -%} + {%- if ('disabled' not in items[name]) or (php not in items[name]['disabled']) -%} + {{- 'true' -}} + {%- endif -%} +{%- endmacro -%} + +{#- +### +### Get 'type' +### +### Returns type string +### +-#} +{%- macro get_type(php, name, items) -%} + {{- fn.get_val(php, name, items, 'type', '') -}} +{%- endmacro -%} + +{#- +### +### Get 'pre' +### +### Returns pre string +### +-#} +{%- macro get_pre(php, name, items) -%} + {{- fn.get_val(php, name, items, 'pre', '') -}} +{%- endmacro -%} + +{#- +### +### Get 'post' +### +### Returns post string +### +-#} +{%- macro get_post(php, name, items) -%} + {{- fn.get_val(php, name, items, 'post', '') -}} +{%- endmacro -%} + +{#- +### +### Get 'build_dep' +### +### Returns json string (jsonified list) of build_dep (use '| to_json' to eval) +### +-#} +{%- macro get_build_dep(php, name, items) -%} + {{- fn.get_list_if_enabled(php, name, items, 'build_dep') -}} +{%- endmacro -%} + +{#- +### +### Get 'run_dep' +### +### Returns json string (jsonified list) of run_dep (use '| to_json' to eval) +### +-#} +{%- macro get_run_dep(php, name, items) -%} + {{- fn.get_list_if_enabled(php, name, items, 'run_dep') -}} +{%- endmacro -%} + + + +{################################################################################################## +# TOOLS SPECIFIC MACROS +##################################################################################################} + +{# --------------------------------------------- REPO ----------------------------------------- -#} +{#- +### +### Get 'deb' +### type: repo +### +-#} +{%- macro tool_repo_get_deb(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'deb', 'repo', '') -}} +{%- endmacro -%} + +{#- +### +### Get 'key' +### type: repo +### +-#} +{%- macro tool_repo_get_key(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'key', 'repo', '') -}} +{%- endmacro -%} + + +{# --------------------------------------------- CUSTOM --------------------------------------- -#} +{#- +### +### Get 'command' +### type: custom +### +-#} +{%- macro tool_custom_get_command(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'command', 'custom', '') -}} +{%- endmacro -%} + + +{# --------------------------------------------- NPM ------------------------------------------ -#} +{#- +### +### Get 'package' +### type: npm +### +-#} +{%- macro tool_npm_get_package(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'package', 'npm', name) -}} +{%- endmacro -%} + +{#- +### +### Get 'version' +### type: npm +### +-#} +{%- macro tool_npm_get_version(php, name, items) -%} + {%- set version = fn.get_val_by_type(php, name, items, 'version', 'npm', '') -%} + {%- if version | length -%} + {{- '@' ~ version -}} + {%- else -%} + {{- '' -}} + {%- endif -%} +{%- endmacro -%} + +{#- +### +### Get 'binary' +### type: npm +### +-#} +{%- macro tool_npm_get_binary(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'binary', 'npm', '') -}} +{%- endmacro -%} + + +{# --------------------------------------------- COMPOSER ------------------------------------- -#} + +{#- +### +### Get 'composer' +### type: composer +### +-#} +{%- macro tool_composer_get_composer(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'composer', 'composer', '') -}} +{%- endmacro -%} + +{#- +### +### Get 'package' +### type: composer +### +-#} +{%- macro tool_composer_get_package(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'package', 'composer', '') -}} +{%- endmacro -%} + +{#- +### +### Get 'version' +### type: composer +### +-#} +{%- macro tool_composer_get_version(php, name, items) -%} + {%- set version = fn.get_val_by_type(php, name, items, 'version', 'composer', '') -%} + {%- if version | length -%} + {{- ':' ~ version -}} + {%- else -%} + {{- '' -}} + {%- endif -%} +{%- endmacro -%} + +{#- +### +### Get 'flags' +### type: composer +### +-#} +{%- macro tool_composer_get_flags(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'flags', 'composer', '') -}} +{%- endmacro -%} + +{#- +### +### Get 'binary' +### type: composer +### +-#} +{%- macro tool_composer_get_binary(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'binary', 'composer', '') -}} +{%- endmacro -%} + + +{# --------------------------------------------- RUBYGEM -------------------------------------- -#} + +{#- +### +### Get 'package' +### type: rubygem +### +-#} +{%- macro tool_rubygem_get_package(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'package', 'rubygem', '') -}} +{%- endmacro -%} + +{#- +### +### Get 'version' +### type: rubygem +### +-#} +{%- macro tool_rubygem_get_version(php, name, items) -%} + {%- set version = fn.get_val_by_type(php, name, items, 'version', 'rubygem', '') -%} + {%- if version | length -%} + {{- ' -v ' ~ version -}} + {%- else -%} + {{- '' -}} + {%- endif -%} +{%- endmacro -%} + + +{# --------------------------------------------- PIP ------------------------------------------ -#} + +{#- +### +### Get 'package' +### type: pip +### +-#} +{%- macro tool_pip_get_package(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'package', 'pip', name) -}} +{%- endmacro -%} + +{#- +### +### Get 'version' +### type: pip +### +-#} +{%- macro tool_pip_get_version(php, name, items) -%} + {%- set version = fn.get_val_by_type(php, name, items, 'version', 'pip', '') -%} + {%- if version | length -%} + {{- '==' ~ version -}} + {%- else -%} + {{- '' -}} + {%- endif -%} +{%- endmacro -%} + + +{# --------------------------------------------- APT ------------------------------------------ -#} + +{#- +### +### Get 'package' +### type: apt +### +-#} +{%- macro tool_apt_get_package(php, name, items) -%} + {%- if is_not_disabled(php, name, items) -%} + {{- fn.get_val_by_type(php, name, items, 'package', 'apt', '') -}} + {%- endif -%} +{%- endmacro -%} diff --git a/.ansible/jinja2/macros.j2 b/.ansible/jinja2/macros.j2 new file mode 100644 index 0000000..b61043d --- /dev/null +++ b/.ansible/jinja2/macros.j2 @@ -0,0 +1,90 @@ +{################################################################################################## +# HELPER MACROS +##################################################################################################} + +{# +### Get generic string value of key if type value matches. +### +### php: The PHP Version +### name: The item name +### items: The items_available list +### key: The key to retrieve the value for +### type: The type key must match this type string +### default: Default value to return if none was found +#} +{%- macro get_val_by_type(php, name, items, key, type, default='' ) -%} + {#- Default return value -#} + {%- set result = default -%} + + {#- PHP Version specific -#} + {%- if php in items[name] and items[name][php]['type'] == type -%} + {%- if key in items[name][php] and items[name][php][key] -%} + {%- set result = items[name][php][key] -%} + {%- elif key in items[name]['all'] and items[name]['all'][key] -%} + {%- set result = items[name]['all'][key] -%} + {%- endif -%} + {#- Defined in 'all' -#} + {%- elif 'all' in items[name] and items[name]['all']['type'] == type -%} + {%- if key in items[name]['all'] and items[name]['all'][key] -%} + {%- set result = items[name]['all'][key] -%} + {%- endif -%} + {%- endif -%} + + {{- result -}} +{%- endmacro -%} + +{#- +### Get generic string value of key. +### +### php: The PHP Version +### name: The item name +### items: The items_available list +### key: The key to retrieve the value for +### default: Default value to return if none was found +-#} +{%- macro get_val(php, name, items, key, default='') -%} + {%- if php in items[name] and key in items[name][php] and items[name][php][key] -%} + {{- items[name][php][key] -}} + {%- elif 'all' in items[name] and key in items[name]['all'] and items[name]['all'][key] -%} + {{- items[name]['all'][key] -}} + {%- else -%} + {{- default -}} + {%- endif -%} +{%- endmacro -%} + +{#- +### Get generic list value (space separated) of not disabled PHP versions. +### +### Returns jsonified string of a list. +### +### Usage: +### {%- set list = [] -%} +### {%- for val in get_enabled_list(php_version, item, items_available) | from_json -%} +### {%- if val -%} +### {{- list.append(val) -}} +### {%- endif -%} +### {%- endfor -%} +### +### php: The PHP Version +### name: The item name +### items: The items_available list +### key: The key to retrieve the value for +-#} +{%- macro get_list_if_enabled(php, name, items, key) -%} + {%- set list = [] %} + {# Not disabled #} + {%- if ('disabled' not in items[name]) or (php not in items[name]['disabled']) -%} + {#- Version specific build dependency available? -#} + {%- if php in items[name] and key in items[name][php] -%} + {%- for val in items[name][php][key] -%} + {{- list.append(val) -}} + {%- endfor -%} + {#- Generic build dependency available? -#} + {%- elif 'all' in items[name] and key in items[name]['all'] -%} + {%- for val in items[name]['all'][key] -%} + {{- list.append(val) -}} + {%- endfor -%} + {%- endif -%} + {%- endif -%} + {{- list | to_json -}} +{%- endmacro -%} diff --git a/.ansible/roles/template/tasks/main.yml b/.ansible/roles/template/tasks/main.yml index 4cb0879..88dd734 100644 --- a/.ansible/roles/template/tasks/main.yml +++ b/.ansible/roles/template/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: generate Dockerfiles - template: + ansible.builtin.template: src: "{{ item.src }}" dest: "{{ item.dst }}" force: True @@ -10,7 +10,7 @@ - "{{ template_dockerfiles }}" - name: generate php configuration files - template: + ansible.builtin.template: src: "{{ item.src }}" dest: "{{ item.dst }}" force: True diff --git a/.github/workflows/action-schedule_master.yml b/.github/workflows/action-schedule_master.yml index ca76c76..4086e1c 100644 --- a/.github/workflows/action-schedule_master.yml +++ b/.github/workflows/action-schedule_master.yml @@ -20,14 +20,14 @@ on: jobs: # ----------------------------------------------------------------------------------------------- - # (1/8) Determine parameter settings + # (1/9) Determine parameter settings # ----------------------------------------------------------------------------------------------- params: uses: ./.github/workflows/params-nightly_master.yml # ----------------------------------------------------------------------------------------------- - # (2/8) Configure Build and Deploy Matrices + # (2/9) Configure Build and Deploy Matrices # ----------------------------------------------------------------------------------------------- configure: needs: [params] @@ -43,7 +43,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (3/8) Build & Test base + # (3/9) Build & Test base # ----------------------------------------------------------------------------------------------- build-base: needs: @@ -72,7 +72,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (4/8) Build & Test mods + # (4/9) Build & Test mods # ----------------------------------------------------------------------------------------------- build-mods: needs: @@ -101,7 +101,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (5/8) Build & Test prod + # (5/9) Build & Test prod # ----------------------------------------------------------------------------------------------- build-prod: needs: @@ -130,9 +130,9 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (6/8) Build & Test work + # (6/9) Build & Test slim # ----------------------------------------------------------------------------------------------- - build-work: + build-slim: needs: - configure - build-prod @@ -143,9 +143,38 @@ jobs: upload_artifact: true matrix: ${{ needs.configure.outputs.matrix_build }} artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} - stage: work + stage: slim stage_prev: prod + test-slim: + needs: + - configure + - build-slim + uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master + with: + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + matrix: ${{ needs.configure.outputs.matrix_build }} + artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} + stage: slim + + + # ----------------------------------------------------------------------------------------------- + # (7/9) Build & Test work + # ----------------------------------------------------------------------------------------------- + build-work: + needs: + - configure + - build-slim + uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master + with: + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + run_tests: false + upload_artifact: true + matrix: ${{ needs.configure.outputs.matrix_build }} + artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} + stage: work + stage_prev: slim + test-work: needs: - configure @@ -159,14 +188,15 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (7/8) Push images + # (8/9) Push images # ----------------------------------------------------------------------------------------------- push-base: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -183,8 +213,9 @@ jobs: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -201,8 +232,9 @@ jobs: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -215,12 +247,32 @@ jobs: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + push-slim: + needs: + - configure + - test-base + - test-mods + - test-prod + - test-slim + - test-work + uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master + with: + can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }} + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + matrix: ${{ needs.configure.outputs.matrix_build }} + artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} + stage: slim + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + push-work: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -235,7 +287,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (8/8) Push Manifests + # (9/9) Push Manifests # ----------------------------------------------------------------------------------------------- manifest-base: needs: @@ -282,6 +334,21 @@ jobs: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + manifest-slim: + needs: + - configure + - push-slim + uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master + with: + can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }} + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + matrix: ${{ needs.configure.outputs.matrix_deploy }} + versions: ${{ needs.configure.outputs.versions }} + stage: slim + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + manifest-work: needs: - configure diff --git a/.github/workflows/action-schedule_tags.yml b/.github/workflows/action-schedule_tags.yml index 835d0f6..9fa449c 100644 --- a/.github/workflows/action-schedule_tags.yml +++ b/.github/workflows/action-schedule_tags.yml @@ -20,14 +20,14 @@ on: jobs: # ----------------------------------------------------------------------------------------------- - # (1/8) Determine parameter settings + # (1/9) Determine parameter settings # ----------------------------------------------------------------------------------------------- params: uses: ./.github/workflows/params-nightly_tags.yml # ----------------------------------------------------------------------------------------------- - # (2/8) Configure Build and Deploy Matrices + # (2/9) Configure Build and Deploy Matrices # ----------------------------------------------------------------------------------------------- configure: needs: [params] @@ -43,7 +43,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (3/8) Build & Test base + # (3/9) Build & Test base # ----------------------------------------------------------------------------------------------- build-base: needs: @@ -72,7 +72,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (4/8) Build & Test mods + # (4/9) Build & Test mods # ----------------------------------------------------------------------------------------------- build-mods: needs: @@ -101,7 +101,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (5/8) Build & Test prod + # (5/9) Build & Test prod # ----------------------------------------------------------------------------------------------- build-prod: needs: @@ -130,9 +130,9 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (6/8) Build & Test work + # (6/9) Build & Test slim # ----------------------------------------------------------------------------------------------- - build-work: + build-slim: needs: - configure - build-prod @@ -143,9 +143,38 @@ jobs: upload_artifact: true matrix: ${{ needs.configure.outputs.matrix_build }} artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} - stage: work + stage: slim stage_prev: prod + test-slim: + needs: + - configure + - build-slim + uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master + with: + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + matrix: ${{ needs.configure.outputs.matrix_build }} + artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} + stage: slim + + + # ----------------------------------------------------------------------------------------------- + # (7/9) Build & Test work + # ----------------------------------------------------------------------------------------------- + build-work: + needs: + - configure + - build-slim + uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master + with: + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + run_tests: false + upload_artifact: true + matrix: ${{ needs.configure.outputs.matrix_build }} + artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} + stage: work + stage_prev: slim + test-work: needs: - configure @@ -159,14 +188,15 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (7/8) Push images + # (8/9) Push images # ----------------------------------------------------------------------------------------------- push-base: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -183,8 +213,9 @@ jobs: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -201,8 +232,9 @@ jobs: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -215,12 +247,32 @@ jobs: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + push-slim: + needs: + - configure + - test-base + - test-mods + - test-prod + - test-slim + - test-work + uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master + with: + can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }} + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + matrix: ${{ needs.configure.outputs.matrix_build }} + artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} + stage: slim + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + push-work: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -235,7 +287,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (8/8) Push Manifests + # (9/9) Push Manifests # ----------------------------------------------------------------------------------------------- manifest-base: needs: @@ -282,6 +334,21 @@ jobs: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + manifest-slim: + needs: + - configure + - push-slim + uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master + with: + can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }} + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + matrix: ${{ needs.configure.outputs.matrix_deploy }} + versions: ${{ needs.configure.outputs.versions }} + stage: slim + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + manifest-work: needs: - configure diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 11ddf9d..7756b71 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -20,14 +20,14 @@ on: jobs: # ----------------------------------------------------------------------------------------------- - # (1/8) Determine parameter settings + # (1/9) Determine parameter settings # ----------------------------------------------------------------------------------------------- params: uses: ./.github/workflows/params.yml # ----------------------------------------------------------------------------------------------- - # (2/8) Configure Build and Deploy Matrices + # (2/9) Configure Build and Deploy Matrices # ----------------------------------------------------------------------------------------------- configure: needs: [params] @@ -43,7 +43,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (3/8) Build & Test base + # (3/9) Build & Test base # ----------------------------------------------------------------------------------------------- build-base: needs: @@ -72,7 +72,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (4/8) Build & Test mods + # (4/9) Build & Test mods # ----------------------------------------------------------------------------------------------- build-mods: needs: @@ -101,7 +101,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (5/8) Build & Test prod + # (5/9) Build & Test prod # ----------------------------------------------------------------------------------------------- build-prod: needs: @@ -130,9 +130,9 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (6/8) Build & Test work + # (6/9) Build & Test slim # ----------------------------------------------------------------------------------------------- - build-work: + build-slim: needs: - configure - build-prod @@ -143,9 +143,38 @@ jobs: upload_artifact: true matrix: ${{ needs.configure.outputs.matrix_build }} artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} - stage: work + stage: slim stage_prev: prod + test-slim: + needs: + - configure + - build-slim + uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master + with: + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + matrix: ${{ needs.configure.outputs.matrix_build }} + artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} + stage: slim + + + # ----------------------------------------------------------------------------------------------- + # (7/9) Build & Test work + # ----------------------------------------------------------------------------------------------- + build-work: + needs: + - configure + - build-slim + uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master + with: + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + run_tests: false + upload_artifact: true + matrix: ${{ needs.configure.outputs.matrix_build }} + artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} + stage: work + stage_prev: slim + test-work: needs: - configure @@ -159,14 +188,15 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (7/8) Push images + # (8/9) Push images # ----------------------------------------------------------------------------------------------- push-base: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -183,8 +213,9 @@ jobs: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -201,8 +232,9 @@ jobs: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -215,12 +247,32 @@ jobs: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + push-slim: + needs: + - configure + - test-base + - test-mods + - test-prod + - test-slim + - test-work + uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master + with: + can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }} + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + matrix: ${{ needs.configure.outputs.matrix_build }} + artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }} + stage: slim + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + push-work: needs: - configure - test-base - - test-prod - test-mods + - test-prod + - test-slim - test-work uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master with: @@ -235,7 +287,7 @@ jobs: # ----------------------------------------------------------------------------------------------- - # (8/8) Push Manifests + # (9/9) Push Manifests # ----------------------------------------------------------------------------------------------- manifest-base: needs: @@ -282,6 +334,21 @@ jobs: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + manifest-slim: + needs: + - configure + - push-slim + uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master + with: + can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }} + has_refs: ${{ needs.configure.outputs.has_refs == 'true' }} + matrix: ${{ needs.configure.outputs.matrix_deploy }} + versions: ${{ needs.configure.outputs.versions }} + stage: slim + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} + manifest-work: needs: - configure diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 8007a14..575ab65 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -56,11 +56,6 @@ jobs: run: | make lint-changelog - - name: Diff generated PHP modules - run: | - make gen-modules - git diff --quiet || { echo "Build Changes"; git diff; git status; false; } - - name: Diff generated Docker files run: | make gen-dockerfiles diff --git a/CHANGELOG.md b/CHANGELOG.md index ea0d2ec..663ee5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,28 @@ ## Unreleased +## Release 0.145 + +This is a massive restructuring release, which adds another layer on top of Ansible to easily manage/edit/add PHP tools and to configure their respective order of building and installing. + +Additionally it introduces a new flavour: `slim` which is an intermediated stage between `prod` and `work`. It allows for a slim image with only required cli tools to work with the Devilbox. + +### Added +- New PHP Flavour: `slim` +- Added `mhsendmail` for `arm64` architecture +- Added `wkhtmltopdf` for `arm64 architecture [#252](https://github.com/devilbox/docker-php-fpm/issues/252) +- Added `taskfile` (https://taskfile.dev/) +- Added mechanism to easily build custom images with custom set of PHP tools +- Added automated PHP tools dependency resolver (order of built is always correct) +- Added tons of documentation + +### Changed +- Split out PHP tools into separate directories + +### Fixed +- Fixed `xdebug` build + + ## Release 0.144 This is a massive restructuring release, which adds another layer on top of Ansible to easily manage/edit/add PHP extensions and to configure their respective order of building and loading. diff --git a/Dockerfiles/base/Dockerfile-5.2 b/Dockerfiles/base/Dockerfile-5.2 index cbc7894..6d1a986 100644 --- a/Dockerfiles/base/Dockerfile-5.2 +++ b/Dockerfiles/base/Dockerfile-5.2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM devilbox/php-fpm-5.2 MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-5.3 b/Dockerfiles/base/Dockerfile-5.3 index 3cc5f3a..59b327b 100644 --- a/Dockerfiles/base/Dockerfile-5.3 +++ b/Dockerfiles/base/Dockerfile-5.3 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM devilbox/php-fpm-5.3 MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-5.4 b/Dockerfiles/base/Dockerfile-5.4 index 418c0aa..e122af9 100644 --- a/Dockerfiles/base/Dockerfile-5.4 +++ b/Dockerfiles/base/Dockerfile-5.4 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM devilbox/php-fpm-5.4 MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-5.5 b/Dockerfiles/base/Dockerfile-5.5 index 40a14c1..709f476 100644 --- a/Dockerfiles/base/Dockerfile-5.5 +++ b/Dockerfiles/base/Dockerfile-5.5 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM devilbox/php-fpm-5.5 MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-5.6 b/Dockerfiles/base/Dockerfile-5.6 index d99785e..15dbf5d 100644 --- a/Dockerfiles/base/Dockerfile-5.6 +++ b/Dockerfiles/base/Dockerfile-5.6 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM php:5.6-fpm MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-7.0 b/Dockerfiles/base/Dockerfile-7.0 index 133cce5..6b6ba72 100644 --- a/Dockerfiles/base/Dockerfile-7.0 +++ b/Dockerfiles/base/Dockerfile-7.0 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM php:7.0-fpm MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-7.1 b/Dockerfiles/base/Dockerfile-7.1 index ba3ac83..c9ac30e 100644 --- a/Dockerfiles/base/Dockerfile-7.1 +++ b/Dockerfiles/base/Dockerfile-7.1 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM php:7.1-fpm MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-7.2 b/Dockerfiles/base/Dockerfile-7.2 index 210d7c4..5f8597c 100644 --- a/Dockerfiles/base/Dockerfile-7.2 +++ b/Dockerfiles/base/Dockerfile-7.2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM php:7.2-fpm MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-7.3 b/Dockerfiles/base/Dockerfile-7.3 index 35146a3..5313118 100644 --- a/Dockerfiles/base/Dockerfile-7.3 +++ b/Dockerfiles/base/Dockerfile-7.3 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM php:7.3-fpm MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-7.4 b/Dockerfiles/base/Dockerfile-7.4 index 1612e70..72b8aea 100644 --- a/Dockerfiles/base/Dockerfile-7.4 +++ b/Dockerfiles/base/Dockerfile-7.4 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM php:7.4-fpm MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-8.0 b/Dockerfiles/base/Dockerfile-8.0 index 07ce20e..67b6ab9 100644 --- a/Dockerfiles/base/Dockerfile-8.0 +++ b/Dockerfiles/base/Dockerfile-8.0 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM devilbox/php-fpm-8.0 MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-8.1 b/Dockerfiles/base/Dockerfile-8.1 index 007692f..74f5914 100644 --- a/Dockerfiles/base/Dockerfile-8.1 +++ b/Dockerfiles/base/Dockerfile-8.1 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM devilbox/php-fpm-8.1 MAINTAINER "cytopia" diff --git a/Dockerfiles/base/Dockerfile-8.2 b/Dockerfiles/base/Dockerfile-8.2 index ebd91c7..a6d0a2b 100644 --- a/Dockerfiles/base/Dockerfile-8.2 +++ b/Dockerfiles/base/Dockerfile-8.2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead. FROM devilbox/php-fpm-8.2 MAINTAINER "cytopia" diff --git a/Dockerfiles/mods/Dockerfile-5.2 b/Dockerfiles/mods/Dockerfile-5.2 index 26465c2..10747eb 100644 --- a/Dockerfiles/mods/Dockerfile-5.2 +++ b/Dockerfiles/mods/Dockerfile-5.2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:5.2-base as builder @@ -549,7 +550,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-5.3 b/Dockerfiles/mods/Dockerfile-5.3 index 9d4c187..7fb69b8 100644 --- a/Dockerfiles/mods/Dockerfile-5.3 +++ b/Dockerfiles/mods/Dockerfile-5.3 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:5.3-base as builder @@ -672,7 +673,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-5.4 b/Dockerfiles/mods/Dockerfile-5.4 index f5122df..1757038 100644 --- a/Dockerfiles/mods/Dockerfile-5.4 +++ b/Dockerfiles/mods/Dockerfile-5.4 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:5.4-base as builder @@ -683,7 +684,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-5.5 b/Dockerfiles/mods/Dockerfile-5.5 index 03b2f74..e1ad527 100644 --- a/Dockerfiles/mods/Dockerfile-5.5 +++ b/Dockerfiles/mods/Dockerfile-5.5 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:5.5-base as builder @@ -721,7 +722,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-5.6 b/Dockerfiles/mods/Dockerfile-5.6 index 1f0a7b0..aef6c86 100644 --- a/Dockerfiles/mods/Dockerfile-5.6 +++ b/Dockerfiles/mods/Dockerfile-5.6 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:5.6-base as builder @@ -740,7 +741,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-7.0 b/Dockerfiles/mods/Dockerfile-7.0 index dbb23b3..402b529 100644 --- a/Dockerfiles/mods/Dockerfile-7.0 +++ b/Dockerfiles/mods/Dockerfile-7.0 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:7.0-base as builder @@ -876,7 +877,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-7.1 b/Dockerfiles/mods/Dockerfile-7.1 index 5134b72..14e6122 100644 --- a/Dockerfiles/mods/Dockerfile-7.1 +++ b/Dockerfiles/mods/Dockerfile-7.1 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:7.1-base as builder @@ -894,7 +895,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-7.2 b/Dockerfiles/mods/Dockerfile-7.2 index 75a9eea..aecfc46 100644 --- a/Dockerfiles/mods/Dockerfile-7.2 +++ b/Dockerfiles/mods/Dockerfile-7.2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:7.2-base as builder @@ -844,10 +845,10 @@ RUN set -eux \ # -------------------- Installing PHP Extension: xdebug -------------------- RUN set -eux \ - # Installation: Generic + # Installation: Version specific # Type: PECL extension # Default: Pecl command - && pecl install xdebug \ + && pecl install xdebug-3.1.6 \ # Enabling && docker-php-ext-enable xdebug \ && true @@ -897,7 +898,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-7.3 b/Dockerfiles/mods/Dockerfile-7.3 index 1a11217..d9c8f38 100644 --- a/Dockerfiles/mods/Dockerfile-7.3 +++ b/Dockerfiles/mods/Dockerfile-7.3 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:7.3-base as builder @@ -838,10 +839,10 @@ RUN set -eux \ # -------------------- Installing PHP Extension: xdebug -------------------- RUN set -eux \ - # Installation: Generic + # Installation: Version specific # Type: PECL extension # Default: Pecl command - && pecl install xdebug \ + && pecl install xdebug-3.1.6 \ # Enabling && docker-php-ext-enable xdebug \ && true @@ -891,7 +892,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-7.4 b/Dockerfiles/mods/Dockerfile-7.4 index 5013c12..109b6b7 100644 --- a/Dockerfiles/mods/Dockerfile-7.4 +++ b/Dockerfiles/mods/Dockerfile-7.4 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:7.4-base as builder @@ -825,10 +826,10 @@ RUN set -eux \ # -------------------- Installing PHP Extension: xdebug -------------------- RUN set -eux \ - # Installation: Generic + # Installation: Version specific # Type: PECL extension # Default: Pecl command - && pecl install xdebug \ + && pecl install xdebug-3.1.6 \ # Enabling && docker-php-ext-enable xdebug \ && true @@ -879,7 +880,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-8.0 b/Dockerfiles/mods/Dockerfile-8.0 index 560ee37..f23781d 100644 --- a/Dockerfiles/mods/Dockerfile-8.0 +++ b/Dockerfiles/mods/Dockerfile-8.0 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:8.0-base as builder @@ -852,7 +853,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-8.1 b/Dockerfiles/mods/Dockerfile-8.1 index 4a2e8c6..8eafece 100644 --- a/Dockerfiles/mods/Dockerfile-8.1 +++ b/Dockerfiles/mods/Dockerfile-8.1 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:8.1-base as builder @@ -787,17 +788,10 @@ RUN set -eux \ # -------------------- Installing PHP Extension: xdebug -------------------- RUN set -eux \ - # Installation: Version specific - # Type: GIT extension - && git clone https://github.com/xdebug/xdebug /tmp/xdebug \ - && cd /tmp/xdebug \ - # Custom: Branch - && git checkout $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1) \ - # Default: Install command - && phpize \ - && ./configure --enable-xdebug \ - && make -j$(getconf _NPROCESSORS_ONLN) \ - && make install \ + # Installation: Generic + # Type: PECL extension + # Default: Pecl command + && pecl install xdebug \ # Enabling && docker-php-ext-enable xdebug \ && true @@ -837,7 +831,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/mods/Dockerfile-8.2 b/Dockerfiles/mods/Dockerfile-8.2 index fd330e1..8e9f879 100644 --- a/Dockerfiles/mods/Dockerfile-8.2 +++ b/Dockerfiles/mods/Dockerfile-8.2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-mods.j2 instead. FROM devilbox/php-fpm:8.2-base as builder @@ -739,17 +740,10 @@ RUN set -eux \ # -------------------- Installing PHP Extension: xdebug -------------------- RUN set -eux \ - # Installation: Version specific - # Type: GIT extension - && git clone https://github.com/xdebug/xdebug /tmp/xdebug \ - && cd /tmp/xdebug \ - # Custom: Branch - && git checkout 3.2.0RC2 \ - # Default: Install command - && phpize \ - && ./configure --enable-xdebug \ - && make -j$(getconf _NPROCESSORS_ONLN) \ - && make install \ + # Installation: Generic + # Type: PECL extension + # Default: Pecl command + && pecl install xdebug \ # Enabling && docker-php-ext-enable xdebug \ && true @@ -789,7 +783,7 @@ RUN set -eux \ # Fix php.ini settings for enabled extensions RUN set -eux \ - && chmod +x "$(php -r 'echo ini_get("extension_dir");')"/* + && find "$(php -r 'echo ini_get("extension_dir");')/" -type f -exec chmod +x {} \; # Fix oracle dir for images that don't have oci installed RUN set -eux \ diff --git a/Dockerfiles/prod/Dockerfile-5.2 b/Dockerfiles/prod/Dockerfile-5.2 index d8a9012..80a8d20 100644 --- a/Dockerfiles/prod/Dockerfile-5.2 +++ b/Dockerfiles/prod/Dockerfile-5.2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:5.2-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-5.3 b/Dockerfiles/prod/Dockerfile-5.3 index c426ceb..c3f002d 100644 --- a/Dockerfiles/prod/Dockerfile-5.3 +++ b/Dockerfiles/prod/Dockerfile-5.3 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:5.3-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-5.4 b/Dockerfiles/prod/Dockerfile-5.4 index aebd697..27a8a9b 100644 --- a/Dockerfiles/prod/Dockerfile-5.4 +++ b/Dockerfiles/prod/Dockerfile-5.4 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:5.4-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-5.5 b/Dockerfiles/prod/Dockerfile-5.5 index a41dfe6..882eef2 100644 --- a/Dockerfiles/prod/Dockerfile-5.5 +++ b/Dockerfiles/prod/Dockerfile-5.5 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:5.5-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-5.6 b/Dockerfiles/prod/Dockerfile-5.6 index e4e7dab..67a61af 100644 --- a/Dockerfiles/prod/Dockerfile-5.6 +++ b/Dockerfiles/prod/Dockerfile-5.6 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:5.6-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-7.0 b/Dockerfiles/prod/Dockerfile-7.0 index 72e7da4..5ca6f8d 100644 --- a/Dockerfiles/prod/Dockerfile-7.0 +++ b/Dockerfiles/prod/Dockerfile-7.0 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:7.0-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-7.1 b/Dockerfiles/prod/Dockerfile-7.1 index e124c91..1f03053 100644 --- a/Dockerfiles/prod/Dockerfile-7.1 +++ b/Dockerfiles/prod/Dockerfile-7.1 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:7.1-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-7.2 b/Dockerfiles/prod/Dockerfile-7.2 index 14ba9a6..5ad6e11 100644 --- a/Dockerfiles/prod/Dockerfile-7.2 +++ b/Dockerfiles/prod/Dockerfile-7.2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:7.2-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-7.3 b/Dockerfiles/prod/Dockerfile-7.3 index d2ec62b..f5ac19c 100644 --- a/Dockerfiles/prod/Dockerfile-7.3 +++ b/Dockerfiles/prod/Dockerfile-7.3 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:7.3-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-7.4 b/Dockerfiles/prod/Dockerfile-7.4 index 006148d..a2cf0c0 100644 --- a/Dockerfiles/prod/Dockerfile-7.4 +++ b/Dockerfiles/prod/Dockerfile-7.4 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:7.4-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-8.0 b/Dockerfiles/prod/Dockerfile-8.0 index ac9757b..b91e558 100644 --- a/Dockerfiles/prod/Dockerfile-8.0 +++ b/Dockerfiles/prod/Dockerfile-8.0 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:8.0-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-8.1 b/Dockerfiles/prod/Dockerfile-8.1 index ab6b2bd..1fb9681 100644 --- a/Dockerfiles/prod/Dockerfile-8.1 +++ b/Dockerfiles/prod/Dockerfile-8.1 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:8.1-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/prod/Dockerfile-8.2 b/Dockerfiles/prod/Dockerfile-8.2 index 88478f8..9ecb883 100644 --- a/Dockerfiles/prod/Dockerfile-8.2 +++ b/Dockerfiles/prod/Dockerfile-8.2 @@ -1,3 +1,4 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-prod.j2 instead. FROM devilbox/php-fpm:8.2-mods MAINTAINER "cytopia" diff --git a/Dockerfiles/slim/Dockerfile-5.2 b/Dockerfiles/slim/Dockerfile-5.2 new file mode 100644 index 0000000..887c3ed --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-5.2 @@ -0,0 +1,622 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:5.2-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until \ + && echo "deb [trusted=yes] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mysql-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && apt-get update \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '5.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '5.2' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '5.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:5.2-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-5.2.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-5.2.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '5.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '5.2' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '5.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.2' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="5.2-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 5.2-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 5.2-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-5.3 b/Dockerfiles/slim/Dockerfile-5.3 new file mode 100644 index 0000000..e9df782 --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-5.3 @@ -0,0 +1,622 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:5.3-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until \ + && echo "deb [trusted=yes] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mysql-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && apt-get update \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '5.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '5.3' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '5.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:5.3-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-5.3.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-5.3.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '5.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '5.3' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '5.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.3' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="5.3-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 5.3-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 5.3-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-5.4 b/Dockerfiles/slim/Dockerfile-5.4 new file mode 100644 index 0000000..8913019 --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-5.4 @@ -0,0 +1,622 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:5.4-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until \ + && echo "deb [trusted=yes] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mysql-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && apt-get update \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '5.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '5.4' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '5.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:5.4-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-5.4.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-5.4.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '5.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '5.4' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '5.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.4' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="5.4-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 5.4-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 5.4-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-5.5 b/Dockerfiles/slim/Dockerfile-5.5 new file mode 100644 index 0000000..8e14e52 --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-5.5 @@ -0,0 +1,622 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:5.5-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until \ + && echo "deb [trusted=yes] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mysql-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && apt-get update \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '5.5' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '5.5' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '5.5' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:5.5-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-5.5.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-5.5.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '5.5' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '5.5' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '5.5' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.5' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="5.5-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 5.5-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 5.5-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-5.6 b/Dockerfiles/slim/Dockerfile-5.6 new file mode 100644 index 0000000..aae0f5d --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-5.6 @@ -0,0 +1,626 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:5.6-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ + && echo "deb http://ftp.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mysql-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && apt-get update \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients \ + mongo-tools; \ + else \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '5.6' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '5.6' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '5.6' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:5.6-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-5.6.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-5.6.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '5.6' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '5.6' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '5.6' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.6' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="5.6-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 5.6-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 5.6-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-7.0 b/Dockerfiles/slim/Dockerfile-7.0 new file mode 100644 index 0000000..456ebfb --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-7.0 @@ -0,0 +1,626 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:7.0-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ + && echo "deb http://ftp.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mysql-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && apt-get update \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients \ + mongo-tools; \ + else \ + apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-clients; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '7.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '7.0' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update; \ + fi \ + \ + && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client; \ + fi \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '7.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:7.0-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-7.0.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-7.0.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '7.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '7.0' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '7.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.0' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="7.0-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 7.0-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 7.0-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-7.1 b/Dockerfiles/slim/Dockerfile-7.1 new file mode 100644 index 0000000..bc7817b --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-7.1 @@ -0,0 +1,620 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:7.1-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ + && echo "deb http://ftp.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mariadb-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ + && echo "deb http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-org-tools \ + mongodb-org-shell \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '7.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '7.1' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '7.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:7.1-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-7.1.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-7.1.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '7.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '7.1' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '7.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.1' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="7.1-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 7.1-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 7.1-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-7.2 b/Dockerfiles/slim/Dockerfile-7.2 new file mode 100644 index 0000000..f5e4ed5 --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-7.2 @@ -0,0 +1,620 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:7.2-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ + && echo "deb http://ftp.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mariadb-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ + && echo "deb http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-org-tools \ + mongodb-org-shell \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '7.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '7.2' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '7.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:7.2-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-7.2.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-7.2.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '7.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '7.2' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '7.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.2' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="7.2-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 7.2-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 7.2-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-7.3 b/Dockerfiles/slim/Dockerfile-7.3 new file mode 100644 index 0000000..1e0155f --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-7.3 @@ -0,0 +1,620 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:7.3-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ + && echo "deb http://ftp.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mariadb-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ + && echo "deb http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-org-tools \ + mongodb-org-shell \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '7.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '7.3' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '7.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:7.3-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-7.3.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-7.3.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '7.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '7.3' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '7.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.3' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="7.3-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 7.3-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 7.3-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-7.4 b/Dockerfiles/slim/Dockerfile-7.4 new file mode 100644 index 0000000..40cb9c2 --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-7.4 @@ -0,0 +1,620 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:7.4-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ + && echo "deb http://ftp.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mariadb-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ + && echo "deb http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-org-tools \ + mongodb-org-shell \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '7.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '7.4' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '7.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:7.4-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-7.4.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-7.4.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '7.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '7.4' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '7.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.4' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="7.4-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 7.4-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 7.4-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-8.0 b/Dockerfiles/slim/Dockerfile-8.0 new file mode 100644 index 0000000..0d927ce --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-8.0 @@ -0,0 +1,620 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:8.0-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ + && echo "deb http://ftp.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mariadb-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ + && echo "deb http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-org-tools \ + mongodb-org-shell \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '8.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '8.0' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '8.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:8.0-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-8.0.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-8.0.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '8.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '8.0' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '8.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.0' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="8.0-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 8.0-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 8.0-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-8.1 b/Dockerfiles/slim/Dockerfile-8.1 new file mode 100644 index 0000000..ff8738b --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-8.1 @@ -0,0 +1,620 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:8.1-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ + && echo "deb http://ftp.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mariadb-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ + && echo "deb http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-org-tools \ + mongodb-org-shell \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '8.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '8.1' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '8.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:8.1-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-8.1.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-8.1.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '8.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '8.1' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '8.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.1' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="8.1-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 8.1-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 8.1-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/slim/Dockerfile-8.2 b/Dockerfiles/slim/Dockerfile-8.2 new file mode 100644 index 0000000..fd71d00 --- /dev/null +++ b/Dockerfiles/slim/Dockerfile-8.2 @@ -0,0 +1,620 @@ +# vi: ft=dockerfile +# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-slim.j2 instead. + +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/4: Devilbox slim image (BASE BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to run Devilbox and its intranet +### +FROM devilbox/php-fpm:8.2-prod as devilbox-slim-base-builder + +### +### Install apt Tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + apt-transport-https \ + ca-certificates \ + curl \ + dirmngr \ + gnupg + +### +### Add apt repositories +### +RUN set -eux \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ + && echo "deb http://ftp.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ + && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ + && true + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libsnappy-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Add common tools +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + file \ + git \ + mariadb-client \ + redis-tools \ + sqlite3 + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required cli tools from group_vars (slim.yml) +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + blackfire-agent \ + \ + && rm -rf /var/lib/apt/lists/* \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && if [ "${DEB_HOST_ARCH}" = "amd64" ] || [ "${DEB_HOST_ARCH}" = "arm64" ]; then \ + MHSENDMAIL_URL="https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_${DEB_HOST_ARCH}" \ + && curl -sS -L --fail "${MHSENDMAIL_URL}" > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + else \ + printf '%s\n%s\n%s\n' '#!/bin/sh' 'echo "Not available for this platform."' 'exit 1' > /usr/local/bin/mhsendmail \ + && chmod +x /usr/local/bin/mhsendmail; \ + fi \ + \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ + && echo "deb http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + mongodb-org-tools \ + mongodb-org-shell \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '8.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '8.2' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && 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][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ + && apt-get update \ + \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + postgresql-client \ + \ + && rm -rf /var/lib/apt/lists/* \ + && if echo '8.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Prepare required shared libraries for copying (keep symlinks) +### +RUN set -eux \ + && LIB_GNU_DIR="/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && USR_LIB_DIR="/usr/lib" \ + && USR_LIB_GNU_DIR="/usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + \ + && mkdir /tmp/lib-gnu \ + && mkdir /tmp/usr-lib \ + && mkdir /tmp/usr-lib-gnu \ + \ + && LIB_GNU="libreadline" \ + && USR_LIB="libsnappy libtcmalloc libv8" \ + && USR_LIB_GNU="liblua libpq libpcrecpp libboost libjemalloc libunwind libhiredis libedit libyaml-cpp libstemmer libsnappy libpcap libbsd liblzf" \ + \ + && for lib in ${LIB_GNU}; do \ + if ls -1 "${LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${LIB_GNU_DIR}"; \ + cp -r ${LIB_GNU_DIR}/${lib}* /tmp/lib-gnu/; \ + fi \ + done \ + && for lib in ${USR_LIB}; do \ + if ls -1 "${USR_LIB_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_DIR}"; \ + cp -r ${USR_LIB_DIR}/${lib}* /tmp/usr-lib/; \ + fi \ + done \ + && for lib in ${USR_LIB_GNU}; do \ + if ls -1 "${USR_LIB_GNU_DIR}/" | grep "^${lib}" >/dev/null; then \ + echo "Coping '${lib}' from: ${USR_LIB_GNU_DIR}"; \ + cp -r ${USR_LIB_GNU_DIR}/${lib}* /tmp/usr-lib-gnu/; \ + fi \ + done + +### +### Fix expected PostgreSQL directories +### +### This might not exist on arm64 as software was not available, +### but they are still needed to be present, so we can copy them. +### +RUN set -eux \ + && if [ ! -d "/usr/lib/postgresql" ]; then \ + mkdir "/usr/lib/postgresql"; \ + fi \ + && if [ ! -d "/usr/share/postgresql-common" ]; then \ + mkdir "/usr/share/postgresql-common"; \ + fi + +### +### Prepare MongoDB binaries for copying. +### +### They might not be available on all architectures (e.g.: arm64). +### +RUN set -eux \ + && mkdir /tmp/mongo \ + && if ls -1 "/usr/bin/" | grep "^mongo" >/dev/null; then \ + cp -r /usr/bin/mongo* /tmp/mongo/; \ + fi + +### +### Strip debugging information to smallen filesize +### +RUN set -eux \ + && STRIP_USR_BINS="blackfire mongo mysql redis sqlite" \ + && STRIP_DIRS="/usr/lib/postgresql/ /usr/share/postgresql-common/ /tmp" \ + \ + && for bin in ${STRIP_USR_BINS}; do \ + ( \ + find /usr/bin/ -name "${bin}"* -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && for dir in ${STRIP_DIRS}; do \ + ( \ + find ${dir} -type f -print0 \ + | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) sh -c \ + 'if [ -f "${1}" ]; then echo "Strip: ${1}"; strip --strip-all -p "${1}" 2>/dev/null || true; fi' -- \ + ) \ + done \ + \ + && strip --strip-all -p /usr/local/bin/mhsendmail 2>/dev/null || true \ + && strip --strip-all -p /usr/local/bin/mysqldump-secure 2>/dev/null || true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/4: Devilbox slim image (BASE) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:8.2-prod as devilbox-slim-base +ARG ARCH + +### +### Install tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- type: apt ---------- + dnsutils \ + iputils-ping \ + netcat-openbsd \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy shared libraries (required by MongoDB, MySQL, PostgreSQL and Redis) +### +COPY --from=devilbox-slim-base-builder /tmp/lib-gnu/ /lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib-gnu/ /usr/lib/${ARCH}-linux-gnu/ +COPY --from=devilbox-slim-base-builder /tmp/usr-lib/ /usr/lib/ + +### +### Copy system files +### +COPY --from=devilbox-slim-base-builder /etc/group /etc/group +COPY --from=devilbox-slim-base-builder /etc/passwd /etc/passwd +COPY --from=devilbox-slim-base-builder /etc/shadow /etc/shadow + +### +### Copy Blackfire +### +COPY --from=devilbox-slim-base-builder /etc/blackfire /etc/blackfire +COPY --from=devilbox-slim-base-builder /etc/default/blackfire-agent /etc/default/blackfire-agent +COPY --from=devilbox-slim-base-builder /usr/bin/blackfire* /usr/bin/ +COPY --from=devilbox-slim-base-builder /var/log/blackfire /var/log/blackfire + +### +### Copy mhsendmail +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mhsendmail /usr/local/bin/ + +### +### Copy MongoDB client (if exists) +### +COPY --from=devilbox-slim-base-builder /tmp/mongo/ /usr/bin/ + +### +### Copy MysQL Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/mysql* /usr/bin/ + +### +### Copy mysqldump-secure +### +COPY --from=devilbox-slim-base-builder /usr/local/bin/mysqldump-secure /usr/local/bin/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.conf /etc/ +COPY --from=devilbox-slim-base-builder /etc/mysqldump-secure.cnf /etc/ +COPY --from=devilbox-slim-base-builder /var/log/mysqldump-secure.log /var/log/ + +### +### Copy PostgreSQL +### +COPY --from=devilbox-slim-base-builder /usr/lib/postgresql /usr/lib/postgresql +COPY --from=devilbox-slim-base-builder /usr/share/postgresql-common /usr/share/postgresql-common +COPY --from=devilbox-slim-base-builder /usr/share/perl5 /usr/share/perl5 + +### +### Create PostgreSQL symlinks +### +RUN set -eux \ + && if [ -f "/usr/share/postgresql-common/pg_wrapper" ]; then \ + ln -s ../share/postgresql-common/pg_wrapper /usr/bin/clusterdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createlang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/createuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/droplang \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/dropuser \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_basebackup \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dump \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_dumpall \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_isready \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivewal \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_receivexlog \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_recvlogical \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pg_restore \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/pgbench \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/psql \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/reindexdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumdb \ + && ln -s ../share/postgresql-common/pg_wrapper /usr/bin/vacuumlo; \ + fi + +### +### Copy Redis Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/redis* /usr/bin/ + + +### +### Copy SQLite Client +### +COPY --from=devilbox-slim-base-builder /usr/bin/sqlite* /usr/bin/ + +### +### ADD PHP configuration files +### +COPY ./data/php-ini.d/php-8.2.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini +COPY ./data/php-fpm.conf/php-fpm-8.2.conf /usr/local/etc/php-fpm.conf + +### +### ADD Devilbox configuration 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 + +### +### Configure Bash +### +RUN set -eux \ + && { \ + echo; \ + echo "# [Devilbox] Ensure /usr/local(s)?bin is in PATH"; \ + echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Source Devilbox main bash config"; \ + echo ". /etc/bash-devilbox"; \ + echo; \ + echo "# [Devilbox] Source Devilbox custom configs"; \ + echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + echo " if [ -r \"\${f}\" ]; then"; \ + echo " . \"\${f}\""; \ + echo " fi"; \ + echo " done"; \ + echo " unset f"; \ + echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/4: Devilbox slim image (BASE TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-slim-base as devilbox-slim-base-test +RUN set -eux \ + && mysql --version \ + && redis-cli --version \ + && sqlite3 --version + +### +### Check if available tools slim +### + +# -------------------- dig -------------------- +RUN set -eux \ + && dig -v 2>&1 | grep -E '[0-9]\.[0-9]' \ + && true + +# -------------------- netcat -------------------- +RUN set -eux \ + && nc -h 2>&1 | grep netcat \ + && true + +# -------------------- ping -------------------- +RUN set -eux \ + && ping -V | grep ^ping \ + && true + +# -------------------- sudo -------------------- +RUN set -eux \ + && sudo --version | grep -E 'version [0-9]+\.[0-9]+' \ + && true + +# -------------------- blackfire -------------------- +RUN set -eux \ + && blackfire version \ + && blackfire-agent -v \ + \ + && true + +# -------------------- mhsendmail -------------------- +RUN set -eux \ + && mhsendmail -h 2>&1 | grep 'Usage' \ + && true + +# -------------------- mongo_client -------------------- +RUN set -eux \ + && if echo '8.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongofiles --version; \ + fi \ + else \ + mongofiles --version; \ + fi \ + \ + && if echo '8.2' | grep -E '^(5.2|5.3|5.4|5.5)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + mongo --version; \ + fi \ + else \ + mongo --version; \ + fi \ + \ + && true + +# -------------------- mysqldumpsecure -------------------- +RUN set -eux \ + && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ + && true + +# -------------------- pgsql_client -------------------- +RUN set -eux \ + && if echo '8.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ + if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ + pg_isready --version; \ + fi \ + else \ + pg_isready --version; \ + fi \ + \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.2' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/4: Devilbox slim image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: slim) +### +FROM devilbox-slim-base as slim +MAINTAINER "cytopia" + +### +### Labels +### +# https://github.com/opencontainers/image-spec/blob/master/annotations.md +#LABEL "org.opencontainers.image.created"="" +#LABEL "org.opencontainers.image.version"="" +#LABEL "org.opencontainers.image.revision"="" +LABEL "maintainer"="cytopia " +LABEL "org.opencontainers.image.authors"="cytopia " +LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm" +LABEL "org.opencontainers.image.vendor"="devilbox" +LABEL "org.opencontainers.image.licenses"="MIT" +LABEL "org.opencontainers.image.ref.name"="8.2-slim" +LABEL "org.opencontainers.image.title"="PHP-FPM 8.2-slim" +LABEL "org.opencontainers.image.description"="PHP-FPM 8.2-slim" + +### +### Volumes +### +VOLUME /shared/backups +VOLUME /var/log/php +VOLUME /var/mail + +### +### Ports +### +EXPOSE 9000 + +### +### Where to start inside the container +### +WORKDIR /shared/httpd + +### +### Entrypoint +### +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Dockerfiles/work/data/bash-devilbox b/Dockerfiles/slim/data/bash-devilbox similarity index 100% rename from Dockerfiles/work/data/bash-devilbox rename to Dockerfiles/slim/data/bash-devilbox diff --git a/Dockerfiles/work/data/docker-entrypoint.d/400-mysqldump-secure.sh b/Dockerfiles/slim/data/docker-entrypoint.d/400-mysqldump-secure.sh similarity index 100% rename from Dockerfiles/work/data/docker-entrypoint.d/400-mysqldump-secure.sh rename to Dockerfiles/slim/data/docker-entrypoint.d/400-mysqldump-secure.sh diff --git a/Dockerfiles/work/data/docker-entrypoint.d/401-update-ca-certificates.sh b/Dockerfiles/slim/data/docker-entrypoint.d/401-update-ca-certificates.sh similarity index 94% rename from Dockerfiles/work/data/docker-entrypoint.d/401-update-ca-certificates.sh rename to Dockerfiles/slim/data/docker-entrypoint.d/401-update-ca-certificates.sh index 53c21b3..3210926 100755 --- a/Dockerfiles/work/data/docker-entrypoint.d/401-update-ca-certificates.sh +++ b/Dockerfiles/slim/data/docker-entrypoint.d/401-update-ca-certificates.sh @@ -17,6 +17,7 @@ update_ca_certificates() { local debug="${2}" if [ -d "${dir}" ]; then + # shellcheck disable=SC2044 for cert in $( find "${dir}" -name \*.crt ); do name="$( basename "${cert}" )" run "cp ${cert} /usr/local/share/ca-certificates/devilbox-${name}" "${debug}" diff --git a/Dockerfiles/work/data/docker-entrypoint.sh b/Dockerfiles/slim/data/docker-entrypoint.sh similarity index 100% rename from Dockerfiles/work/data/docker-entrypoint.sh rename to Dockerfiles/slim/data/docker-entrypoint.sh diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-5.2.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-5.2.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-5.2.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-5.2.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-5.3.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-5.3.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-5.3.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-5.3.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-5.4.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-5.4.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-5.4.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-5.4.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-5.5.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-5.5.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-5.5.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-5.5.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-5.6.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-5.6.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-5.6.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-5.6.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-7.0.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-7.0.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-7.0.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-7.0.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-7.1.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-7.1.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-7.1.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-7.1.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-7.2.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-7.2.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-7.2.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-7.2.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-7.3.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-7.3.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-7.3.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-7.3.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-7.4.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-7.4.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-7.4.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-7.4.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-8.0.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-8.0.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-8.0.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-8.0.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-8.1.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-8.1.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-8.1.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-8.1.conf diff --git a/Dockerfiles/work/data/php-fpm.conf/php-fpm-8.2.conf b/Dockerfiles/slim/data/php-fpm.conf/php-fpm-8.2.conf similarity index 100% rename from Dockerfiles/work/data/php-fpm.conf/php-fpm-8.2.conf rename to Dockerfiles/slim/data/php-fpm.conf/php-fpm-8.2.conf diff --git a/Dockerfiles/work/data/php-ini.d/php-5.2.ini b/Dockerfiles/slim/data/php-ini.d/php-5.2.ini similarity index 96% rename from Dockerfiles/work/data/php-ini.d/php-5.2.ini rename to Dockerfiles/slim/data/php-ini.d/php-5.2.ini index 2ffce84..616ff51 100644 --- a/Dockerfiles/work/data/php-ini.d/php-5.2.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-5.2.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 5.2-work +; # Devilbox PHP defaults for 5.2-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-5.3.ini b/Dockerfiles/slim/data/php-ini.d/php-5.3.ini similarity index 96% rename from Dockerfiles/work/data/php-ini.d/php-5.3.ini rename to Dockerfiles/slim/data/php-ini.d/php-5.3.ini index 64b46a5..9496d36 100644 --- a/Dockerfiles/work/data/php-ini.d/php-5.3.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-5.3.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 5.3-work +; # Devilbox PHP defaults for 5.3-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-5.4.ini b/Dockerfiles/slim/data/php-ini.d/php-5.4.ini similarity index 97% rename from Dockerfiles/work/data/php-ini.d/php-5.4.ini rename to Dockerfiles/slim/data/php-ini.d/php-5.4.ini index e9b8f64..91e4ef3 100644 --- a/Dockerfiles/work/data/php-ini.d/php-5.4.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-5.4.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 5.4-work +; # Devilbox PHP defaults for 5.4-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-5.5.ini b/Dockerfiles/slim/data/php-ini.d/php-5.5.ini similarity index 97% rename from Dockerfiles/work/data/php-ini.d/php-5.5.ini rename to Dockerfiles/slim/data/php-ini.d/php-5.5.ini index 8ca7004..067fb91 100644 --- a/Dockerfiles/work/data/php-ini.d/php-5.5.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-5.5.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 5.5-work +; # Devilbox PHP defaults for 5.5-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-5.6.ini b/Dockerfiles/slim/data/php-ini.d/php-5.6.ini similarity index 97% rename from Dockerfiles/work/data/php-ini.d/php-5.6.ini rename to Dockerfiles/slim/data/php-ini.d/php-5.6.ini index 5c84e34..9079c8e 100644 --- a/Dockerfiles/work/data/php-ini.d/php-5.6.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-5.6.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 5.6-work +; # Devilbox PHP defaults for 5.6-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-7.0.ini b/Dockerfiles/slim/data/php-ini.d/php-7.0.ini similarity index 97% rename from Dockerfiles/work/data/php-ini.d/php-7.0.ini rename to Dockerfiles/slim/data/php-ini.d/php-7.0.ini index 4bd2872..591c0cf 100644 --- a/Dockerfiles/work/data/php-ini.d/php-7.0.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-7.0.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 7.0-work +; # Devilbox PHP defaults for 7.0-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-7.1.ini b/Dockerfiles/slim/data/php-ini.d/php-7.1.ini similarity index 97% rename from Dockerfiles/work/data/php-ini.d/php-7.1.ini rename to Dockerfiles/slim/data/php-ini.d/php-7.1.ini index 0fc952c..bc516ec 100644 --- a/Dockerfiles/work/data/php-ini.d/php-7.1.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-7.1.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 7.1-work +; # Devilbox PHP defaults for 7.1-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-7.2.ini b/Dockerfiles/slim/data/php-ini.d/php-7.2.ini similarity index 96% rename from Dockerfiles/work/data/php-ini.d/php-7.2.ini rename to Dockerfiles/slim/data/php-ini.d/php-7.2.ini index 14a8e3f..3219ea4 100644 --- a/Dockerfiles/work/data/php-ini.d/php-7.2.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-7.2.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 7.2-work +; # Devilbox PHP defaults for 7.2-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-7.3.ini b/Dockerfiles/slim/data/php-ini.d/php-7.3.ini similarity index 96% rename from Dockerfiles/work/data/php-ini.d/php-7.3.ini rename to Dockerfiles/slim/data/php-ini.d/php-7.3.ini index edda098..f0c11e6 100644 --- a/Dockerfiles/work/data/php-ini.d/php-7.3.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-7.3.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 7.3-work +; # Devilbox PHP defaults for 7.3-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-7.4.ini b/Dockerfiles/slim/data/php-ini.d/php-7.4.ini similarity index 96% rename from Dockerfiles/work/data/php-ini.d/php-7.4.ini rename to Dockerfiles/slim/data/php-ini.d/php-7.4.ini index 7f3f75d..499814b 100644 --- a/Dockerfiles/work/data/php-ini.d/php-7.4.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-7.4.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 7.4-work +; # Devilbox PHP defaults for 7.4-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-8.0.ini b/Dockerfiles/slim/data/php-ini.d/php-8.0.ini similarity index 96% rename from Dockerfiles/work/data/php-ini.d/php-8.0.ini rename to Dockerfiles/slim/data/php-ini.d/php-8.0.ini index 2aeea6e..b1fbb8a 100644 --- a/Dockerfiles/work/data/php-ini.d/php-8.0.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-8.0.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 8.0-work +; # Devilbox PHP defaults for 8.0-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-8.1.ini b/Dockerfiles/slim/data/php-ini.d/php-8.1.ini similarity index 96% rename from Dockerfiles/work/data/php-ini.d/php-8.1.ini rename to Dockerfiles/slim/data/php-ini.d/php-8.1.ini index 08952f7..a0a6f02 100644 --- a/Dockerfiles/work/data/php-ini.d/php-8.1.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-8.1.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 8.1-work +; # Devilbox PHP defaults for 8.1-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/php-ini.d/php-8.2.ini b/Dockerfiles/slim/data/php-ini.d/php-8.2.ini similarity index 96% rename from Dockerfiles/work/data/php-ini.d/php-8.2.ini rename to Dockerfiles/slim/data/php-ini.d/php-8.2.ini index b9dc962..8ed9020 100644 --- a/Dockerfiles/work/data/php-ini.d/php-8.2.ini +++ b/Dockerfiles/slim/data/php-ini.d/php-8.2.ini @@ -1,5 +1,5 @@ ; ############################################################ -; # Devilbox PHP defaults for 8.2-work +; # Devilbox PHP defaults for 8.2-slim ; ############################################################ ; Each PHP flavour (base, mods, prod, work) might have its own php.ini. diff --git a/Dockerfiles/work/data/sudo-devilbox b/Dockerfiles/slim/data/sudo-devilbox similarity index 100% rename from Dockerfiles/work/data/sudo-devilbox rename to Dockerfiles/slim/data/sudo-devilbox diff --git a/Dockerfiles/work/Dockerfile-5.2 b/Dockerfiles/work/Dockerfile-5.2 index e9a73d2..aaa6951 100644 --- a/Dockerfiles/work/Dockerfile-5.2 +++ b/Dockerfiles/work/Dockerfile-5.2 @@ -1,8 +1,789 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:5.2-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:5.2-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython-dev \ + && rm -rf /var/lib/apt/lists/* + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="17" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:5.2-slim as devilbox-work-help + + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.2' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + moreutils \ + ruby \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mixlib-config -v 2.2.4 \ + \ + && gem install mdl -v 0.5.0 \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + moreutils \ + ruby \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.2' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,715 +803,6 @@ LABEL "org.opencontainers.image.ref.name"="5.2-work" LABEL "org.opencontainers.image.title"="PHP-FPM 5.2-work" LABEL "org.opencontainers.image.description"="PHP-FPM 5.2-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until \ - && echo "deb [trusted=yes] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mysql-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="17" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && apt-get update \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/wkhtmltopdf/releases | awk -F\" '/wkhtmltopdf.*.jessie_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- ffi -------------------- - && gem install ffi -v 1.12.2 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.2' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '5.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '5.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - \ -# -------------------- Composer -------------------- - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-5.2.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-5.2.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -738,19 +810,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-5.3 b/Dockerfiles/work/Dockerfile-5.3 index 63f4684..fdc0339 100644 --- a/Dockerfiles/work/Dockerfile-5.3 +++ b/Dockerfiles/work/Dockerfile-5.3 @@ -1,8 +1,880 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:5.3-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:5.3-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-1 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="17" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:5.3-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.3' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + moreutils \ + ruby \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mixlib-config -v 2.2.4 \ + \ + && gem install mdl -v 0.5.0 \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="4" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://github.com/wp-cli/wp-cli/releases/download/v1.5.1/wp-cli-1.5.1.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + moreutils \ + ruby \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.3' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,783 +894,6 @@ LABEL "org.opencontainers.image.ref.name"="5.3-work" LABEL "org.opencontainers.image.title"="PHP-FPM 5.3-work" LABEL "org.opencontainers.image.description"="PHP-FPM 5.3-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until \ - && echo "deb [trusted=yes] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mysql-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-1 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="17" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && apt-get update \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- drush7 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush7 \ -&& cd /usr/local/src/drush7 \ -&& git checkout 7.4.0 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush7 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush7 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush7/drush /usr/local/bin/drush7 \ -&& rm -rf /usr/local/src/drush7/.git \ -&& rm -rf /usr/local/src/drush7/docs \ -&& rm -rf /usr/local/src/drush7/examples \ -&& rm -rf /usr/local/src/drush7/misc \ - \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phalcon -------------------- - && git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ -&& cd /usr/local/src/phalcon-devtools \ -&& git checkout v2.0.7 \ - \ - && 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 \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- phpunit -------------------- - && curl -sS -k -L --fail https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit \ -&& chmod +x /usr/local/bin/phpunit \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/wkhtmltopdf/releases | awk -F\" '/wkhtmltopdf.*.jessie_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://github.com/wp-cli/wp-cli/releases/download/v1.5.1/wp-cli-1.5.1.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ -# -------------------- prestissimo -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- ffi -------------------- - && gem install ffi -v 1.12.2 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.3' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '5.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '5.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && drush7 --version | grep -E '7[.0-9]+\s*$' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phalcon commands | grep -E '[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-5.3.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-5.3.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -806,19 +901,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-5.4 b/Dockerfiles/work/Dockerfile-5.4 index 42546e1..1663791 100644 --- a/Dockerfiles/work/Dockerfile-5.4 +++ b/Dockerfiles/work/Dockerfile-5.4 @@ -1,8 +1,918 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:5.4-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:5.4-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="17" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:5.4-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.4' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + moreutils \ + ruby \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mixlib-config -v 2.2.4 \ + \ + && gem install mdl -v 0.5.0 \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/releases/v3.3.0/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer:1.3.7 \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="4" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + moreutils \ + ruby \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.4' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,828 +932,6 @@ LABEL "org.opencontainers.image.ref.name"="5.4-work" LABEL "org.opencontainers.image.title"="PHP-FPM 5.4-work" LABEL "org.opencontainers.image.description"="PHP-FPM 5.4-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until \ - && echo "deb [trusted=yes] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mysql-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="17" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && apt-get update \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/releases/v3.3.0/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- drush7 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush7 \ -&& cd /usr/local/src/drush7 \ -&& git checkout 7.4.0 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush7 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush7 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush7/drush /usr/local/bin/drush7 \ -&& rm -rf /usr/local/src/drush7/.git \ -&& rm -rf /usr/local/src/drush7/docs \ -&& rm -rf /usr/local/src/drush7/examples \ -&& rm -rf /usr/local/src/drush7/misc \ - \ - \ -# -------------------- drush8 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush8 \ -&& cd /usr/local/src/drush8 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/8[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush8 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush8 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush8/drush /usr/local/bin/drush8 \ -&& rm -rf /usr/local/src/drush8/.git \ -&& rm -rf /usr/local/src/drush8/docs \ -&& rm -rf /usr/local/src/drush8/examples \ -&& rm -rf /usr/local/src/drush8/misc \ - \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- laravel -------------------- - && git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \ -&& cd /usr/local/src/laravel-installer \ -&& git checkout v1.3.7 \ - \ - && 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ -&& rm -rf /usr/local/src/laravel-installer/laravel/.git \ - \ - && ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phalcon -------------------- - && git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ -&& cd /usr/local/src/phalcon-devtools \ -&& git checkout v2.0.9 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/phalcon-devtools \ -&& su - ${MY_USER} -c 'cd /usr/local/src/phalcon-devtools && ./phalcon.sh' \ -&& ln -sf /usr/local/src/phalcon-devtools/phalcon.php /usr/local/bin/phalcon \ -&& cd / \ -&& rm -rf /usr/local/src/phalcon-devtools/.git \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- phpunit -------------------- - && curl -sS -k -L --fail https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit \ -&& chmod +x /usr/local/bin/phpunit \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/wkhtmltopdf/releases | awk -F\" '/wkhtmltopdf.*.jessie_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ -# -------------------- codeception -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \ - && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ - \ -# -------------------- prestissimo -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- ffi -------------------- - && gem install ffi -v 1.12.2 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.4' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '5.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '5.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && drush7 --version | grep -E '7[.0-9]+\s*$' \ - && drush8 --version | grep -E '8[.0-9]+\s*$' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phalcon commands | grep -E '[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' \ - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-5.4.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-5.4.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -851,19 +939,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-5.5 b/Dockerfiles/work/Dockerfile-5.5 index b59759f..6b346bb 100644 --- a/Dockerfiles/work/Dockerfile-5.5 +++ b/Dockerfiles/work/Dockerfile-5.5 @@ -1,8 +1,1005 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:5.5-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:5.5-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="17" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:5.5-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.5' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + moreutils \ + ruby \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache asgardcms/asgardcms-installer:dev-master \ + && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mixlib-config -v 2.2.4 \ + \ + && gem install mdl -v 0.5.0 \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/releases/v4.3.4/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer:2.2.0 \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/lumen-installer \ + && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache phalcon/devtools:3.4.11 \ + && ln -s /usr/local/src/composer/vendor/phalcon/devtools/phalcon /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="4" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + moreutils \ + ruby \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.5' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,845 +1019,6 @@ LABEL "org.opencontainers.image.ref.name"="5.5-work" LABEL "org.opencontainers.image.title"="PHP-FPM 5.5-work" LABEL "org.opencontainers.image.description"="PHP-FPM 5.5-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until \ - && echo "deb [trusted=yes] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mysql-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="17" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && apt-get update \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/releases/v4.3.4/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- drush7 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush7 \ -&& cd /usr/local/src/drush7 \ -&& git checkout 7.4.0 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush7 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush7 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush7/drush /usr/local/bin/drush7 \ -&& rm -rf /usr/local/src/drush7/.git \ -&& rm -rf /usr/local/src/drush7/docs \ -&& rm -rf /usr/local/src/drush7/examples \ -&& rm -rf /usr/local/src/drush7/misc \ - \ - \ -# -------------------- drush8 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush8 \ -&& cd /usr/local/src/drush8 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/8[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush8 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush8 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush8/drush /usr/local/bin/drush8 \ -&& rm -rf /usr/local/src/drush8/.git \ -&& rm -rf /usr/local/src/drush8/docs \ -&& rm -rf /usr/local/src/drush8/examples \ -&& rm -rf /usr/local/src/drush8/misc \ - \ - \ -# -------------------- drupalconsole -------------------- - && DURL="https://github.com/hechoendrupal/drupal-console-launcher/releases/download/1.9.4/drupal.phar" \ - && curl -sS -L --fail "${DURL}" -L -o /usr/local/bin/drupal \ - && chmod +x /usr/local/bin/drupal \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- laravel -------------------- - && git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \ -&& cd /usr/local/src/laravel-installer \ -&& git checkout v2.0.0 \ - \ - && 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ -&& rm -rf /usr/local/src/laravel-installer/laravel/.git \ - \ - && ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phalcon -------------------- - && git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ -&& cd /usr/local/src/phalcon-devtools \ -&& git checkout v3.4.11 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/phalcon-devtools \ -&& su - ${MY_USER} -c 'cd /usr/local/src/phalcon-devtools && ./phalcon.sh' \ -&& ln -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ -&& chmod +x /usr/local/bin/phalcon \ -&& cd / \ -&& rm -rf /usr/local/src/phalcon-devtools/.git \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- phpunit -------------------- - && curl -sS -k -L --fail https://phar.phpunit.de/phpunit-4.phar > /usr/local/bin/phpunit \ -&& chmod +x /usr/local/bin/phpunit \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/wkhtmltopdf/releases | awk -F\" '/wkhtmltopdf.*.jessie_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ -# -------------------- asgardcms -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer \ - && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ - \ -# -------------------- codeception -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \ - && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ - \ -# -------------------- lumen -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \ - && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ - \ -# -------------------- prestissimo -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- ffi -------------------- - && gem install ffi -v 1.12.2 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.5' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '5.5' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '5.5' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && drush7 --version | grep -E '7[.0-9]+\s*$' \ - && drush8 --version | grep -E '8[.0-9]+\s*$' \ - && drupal --version | grep -E 'Drupal Console Launcher\s*[0-9][.0-9]' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phalcon commands | grep -E '[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' \ - && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' \ - && lumen --version 2>/dev/null | grep -E '^Lumen Installer\s[0-9][.0-9]+$' \ - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-5.5.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-5.5.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -868,19 +1026,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-5.6 b/Dockerfiles/work/Dockerfile-5.6 index 7b814d4..ee00b61 100644 --- a/Dockerfiles/work/Dockerfile-5.6 +++ b/Dockerfiles/work/Dockerfile-5.6 @@ -1,8 +1,1043 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:5.6-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:5.6-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="17" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:5.6-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.6' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont1 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache asgardcms/asgardcms-installer:dev-master \ + && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mixlib-config -v 2.2.4 \ + \ + && gem install mdl -v 0.5.0 \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/releases/v4.3.4/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer:2.2.0 \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/lumen-installer \ + && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache phalcon/devtools:3.4.11 \ + && ln -s /usr/local/src/composer/vendor/phalcon/devtools/phalcon /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="5" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && OS_RELEASE="stretch" \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont1 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.6' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,863 +1057,6 @@ LABEL "org.opencontainers.image.ref.name"="5.6-work" LABEL "org.opencontainers.image.title"="PHP-FPM 5.6-work" LABEL "org.opencontainers.image.description"="PHP-FPM 5.6-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ - && echo "deb http://ftp.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - certbot \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mysql-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - zsh-common \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="17" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && apt-get update \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients \ - mongo-tools; \ -else \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/releases/v4.3.4/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- drush7 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush7 \ -&& cd /usr/local/src/drush7 \ -&& git checkout 7.4.0 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush7 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush7 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush7/drush /usr/local/bin/drush7 \ -&& rm -rf /usr/local/src/drush7/.git \ -&& rm -rf /usr/local/src/drush7/docs \ -&& rm -rf /usr/local/src/drush7/examples \ -&& rm -rf /usr/local/src/drush7/misc \ - \ - \ -# -------------------- drush8 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush8 \ -&& cd /usr/local/src/drush8 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/8[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush8 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush8 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush8/drush /usr/local/bin/drush8 \ -&& rm -rf /usr/local/src/drush8/.git \ -&& rm -rf /usr/local/src/drush8/docs \ -&& rm -rf /usr/local/src/drush8/examples \ -&& rm -rf /usr/local/src/drush8/misc \ - \ - \ -# -------------------- drush9 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush9 \ -&& cd /usr/local/src/drush9 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/9[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush9 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush9 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress' \ -&& ln -s /usr/local/src/drush9/drush /usr/local/bin/drush9 \ -&& rm -rf /usr/local/src/drush9/.git \ -&& rm -rf /usr/local/src/drush9/docs \ -&& rm -rf /usr/local/src/drush9/examples \ -&& rm -rf /usr/local/src/drush9/misc \ - \ - \ -# -------------------- drupalconsole -------------------- - && DURL="https://github.com/hechoendrupal/drupal-console-launcher/releases/download/1.9.4/drupal.phar" \ - && curl -sS -L --fail "${DURL}" -L -o /usr/local/bin/drupal \ - && chmod +x /usr/local/bin/drupal \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- laravel -------------------- - && git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \ -&& cd /usr/local/src/laravel-installer \ -&& git checkout v2.0.0 \ - \ - && 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ -&& rm -rf /usr/local/src/laravel-installer/laravel/.git \ - \ - && ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phalcon -------------------- - && git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ -&& cd /usr/local/src/phalcon-devtools \ -&& git checkout v3.4.11 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/phalcon-devtools \ -&& su - ${MY_USER} -c 'cd /usr/local/src/phalcon-devtools && ./phalcon.sh' \ -&& ln -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ -&& chmod +x /usr/local/bin/phalcon \ -&& cd / \ -&& rm -rf /usr/local/src/phalcon-devtools/.git \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- phpunit -------------------- - && curl -sS -k -L --fail https://phar.phpunit.de/phpunit-5.phar > /usr/local/bin/phpunit \ -&& chmod +x /usr/local/bin/phpunit \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases | awk -F\" '/wkhtmltopdf.*.stretch_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ -# -------------------- asgardcms -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer \ - && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ - \ -# -------------------- codeception -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \ - && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ - \ -# -------------------- lumen -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \ - && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ - \ -# -------------------- prestissimo -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.6' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '5.6' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '5.6' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && drush7 --version | grep -E '7[.0-9]+\s*$' \ - && drush8 --version | grep -E '8[.0-9]+\s*$' \ - && drush9 --version | grep -E '9[.0-9]+\s*$' \ - && drupal --version | grep -E 'Drupal Console Launcher\s*[0-9][.0-9]' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phalcon commands | grep -E '[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' \ - && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' \ - && lumen --version 2>/dev/null | grep -E '^Lumen Installer\s[0-9][.0-9]+$' \ - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-5.6.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-5.6.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -886,19 +1064,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-7.0 b/Dockerfiles/work/Dockerfile-7.0 index cca09c9..81eb367 100644 --- a/Dockerfiles/work/Dockerfile-7.0 +++ b/Dockerfiles/work/Dockerfile-7.0 @@ -1,8 +1,1043 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:7.0-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:7.0-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="17" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:7.0-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.0' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont1 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache asgardcms/asgardcms-installer:dev-master \ + && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mixlib-config -v 2.2.4 \ + \ + && gem install mdl -v 0.5.0 \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/releases/v6.7.0/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer:2.2.0 \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/lumen-installer \ + && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache phalcon/devtools:3.4.11 \ + && ln -s /usr/local/src/composer/vendor/phalcon/devtools/phalcon /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="6" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && OS_RELEASE="stretch" \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont1 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.0' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,842 +1057,6 @@ LABEL "org.opencontainers.image.ref.name"="7.0-work" LABEL "org.opencontainers.image.title"="PHP-FPM 7.0-work" LABEL "org.opencontainers.image.description"="PHP-FPM 7.0-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ - && echo "deb http://ftp.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - certbot \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mysql-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - zsh-common \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="17" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ - && apt-get update; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && apt-get update \ - && if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients \ - mongo-tools; \ -else \ - apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-clients; \ -fi \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/releases/v6.7.0/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- drush7 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush7 \ -&& cd /usr/local/src/drush7 \ -&& git checkout 7.4.0 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush7 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush7 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush7/drush /usr/local/bin/drush7 \ -&& rm -rf /usr/local/src/drush7/.git \ -&& rm -rf /usr/local/src/drush7/docs \ -&& rm -rf /usr/local/src/drush7/examples \ -&& rm -rf /usr/local/src/drush7/misc \ - \ - \ -# -------------------- drush8 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush8 \ -&& cd /usr/local/src/drush8 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/8[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush8 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush8 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush8/drush /usr/local/bin/drush8 \ -&& rm -rf /usr/local/src/drush8/.git \ -&& rm -rf /usr/local/src/drush8/docs \ -&& rm -rf /usr/local/src/drush8/examples \ -&& rm -rf /usr/local/src/drush8/misc \ - \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- laravel -------------------- - && git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \ -&& cd /usr/local/src/laravel-installer \ -&& git checkout v2.0.0 \ - \ - && 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ -&& rm -rf /usr/local/src/laravel-installer/laravel/.git \ - \ - && ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phalcon -------------------- - && git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ -&& cd /usr/local/src/phalcon-devtools \ -&& git checkout v3.4.11 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/phalcon-devtools \ -&& su - ${MY_USER} -c 'cd /usr/local/src/phalcon-devtools && ./phalcon.sh' \ -&& ln -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ -&& chmod +x /usr/local/bin/phalcon \ -&& cd / \ -&& rm -rf /usr/local/src/phalcon-devtools/.git \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- phpunit -------------------- - && curl -sS -k -L --fail https://phar.phpunit.de/phpunit-6.phar > /usr/local/bin/phpunit \ -&& chmod +x /usr/local/bin/phpunit \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases | awk -F\" '/wkhtmltopdf.*.stretch_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont1 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ -# -------------------- asgardcms -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer \ - && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ - \ -# -------------------- codeception -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \ - && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ - \ -# -------------------- lumen -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \ - && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ - \ -# -------------------- prestissimo -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.0' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '7.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '7.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && drush7 --version | grep -E '7[.0-9]+\s*$' \ - && drush8 --version | grep -E '8[.0-9]+\s*$' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phalcon commands | grep -E '[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' \ - && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' \ - && lumen --version 2>/dev/null | grep -E '^Lumen Installer\s[0-9][.0-9]+$' \ - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-7.0.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-7.0.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -865,19 +1064,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-7.1 b/Dockerfiles/work/Dockerfile-7.1 index 151c7e3..c2b8d06 100644 --- a/Dockerfiles/work/Dockerfile-7.1 +++ b/Dockerfiles/work/Dockerfile-7.1 @@ -1,8 +1,1043 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:7.1-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:7.1-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="--lts" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:7.1-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.1' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache asgardcms/asgardcms-installer:dev-master \ + && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install chef-utils -v 16.6.14 \ + \ + && gem install mdl -v 0.11.0 \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/releases/v6.7.0/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer:2.3.0 \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/lumen-installer \ + && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache phalcon/devtools:3.4.11 \ + && ln -s /usr/local/src/composer/vendor/phalcon/devtools/phalcon /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="7" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && OS_RELEASE="buster" \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.1' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,835 +1057,6 @@ LABEL "org.opencontainers.image.ref.name"="7.1-work" LABEL "org.opencontainers.image.title"="PHP-FPM 7.1-work" LABEL "org.opencontainers.image.description"="PHP-FPM 7.1-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ - && echo "deb http://ftp.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - certbot \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mariadb-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="--lts" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ -&& echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ -&& echo "deb http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-org-tools \ - mongodb-org-shell \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/releases/v6.7.0/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- drush7 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush7 \ -&& cd /usr/local/src/drush7 \ -&& git checkout 7.4.0 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush7 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush7 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush7/drush /usr/local/bin/drush7 \ -&& rm -rf /usr/local/src/drush7/.git \ -&& rm -rf /usr/local/src/drush7/docs \ -&& rm -rf /usr/local/src/drush7/examples \ -&& rm -rf /usr/local/src/drush7/misc \ - \ - \ -# -------------------- drush8 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush8 \ -&& cd /usr/local/src/drush8 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/8[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush8 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush8 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush8/drush /usr/local/bin/drush8 \ -&& rm -rf /usr/local/src/drush8/.git \ -&& rm -rf /usr/local/src/drush8/docs \ -&& rm -rf /usr/local/src/drush8/examples \ -&& rm -rf /usr/local/src/drush8/misc \ - \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- laravel -------------------- - && git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \ -&& cd /usr/local/src/laravel-installer \ -&& git checkout $(git tag | grep '^v2\.3\.' | sort -u | tail -1) \ - \ - && 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ -&& rm -rf /usr/local/src/laravel-installer/laravel/.git \ - \ - && ln -s /usr/local/src/laravel-installer/laravel /usr/local/bin/laravel \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phalcon -------------------- - && git clone https://github.com/phalcon/phalcon-devtools /usr/local/src/phalcon-devtools \ -&& cd /usr/local/src/phalcon-devtools \ -&& git checkout v3.4.11 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/phalcon-devtools \ -&& su - ${MY_USER} -c 'cd /usr/local/src/phalcon-devtools && ./phalcon.sh' \ -&& ln -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ -&& chmod +x /usr/local/bin/phalcon \ -&& cd / \ -&& rm -rf /usr/local/src/phalcon-devtools/.git \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- phpunit -------------------- - && curl -sS -k -L --fail https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit \ -&& chmod +x /usr/local/bin/phpunit \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases | awk -F\" '/wkhtmltopdf.*.stretch_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont2 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ -# -------------------- asgardcms -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer \ - && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ - \ -# -------------------- codeception -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \ - && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ - \ -# -------------------- lumen -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \ - && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ - \ -# -------------------- prestissimo -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.1' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '7.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '7.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && drush7 --version | grep -E '7[.0-9]+\s*$' \ - && drush8 --version | grep -E '8[.0-9]+\s*$' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phalcon commands | grep -E '[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' \ - && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' \ - && lumen --version 2>/dev/null | grep -E '^Lumen Installer\s[0-9][.0-9]+$' \ - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-7.1.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-7.1.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -858,19 +1064,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-7.2 b/Dockerfiles/work/Dockerfile-7.2 index 6baffbf..0573cb7 100644 --- a/Dockerfiles/work/Dockerfile-7.2 +++ b/Dockerfiles/work/Dockerfile-7.2 @@ -1,8 +1,1043 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:7.2-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:7.2-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="--lts" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:7.2-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.2' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache asgardcms/asgardcms-installer:dev-master \ + && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install chef-utils -v 16.6.14 \ + \ + && gem install mdl -v 0.11.0 \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer:4.0.0 \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/bin/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/lumen-installer \ + && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache phalcon/devtools \ + && ln -s /usr/local/src/composer/vendor/phalcon/devtools/phalcon /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="8" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && OS_RELEASE="buster" \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.2' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,857 +1057,6 @@ LABEL "org.opencontainers.image.ref.name"="7.2-work" LABEL "org.opencontainers.image.title"="PHP-FPM 7.2-work" LABEL "org.opencontainers.image.description"="PHP-FPM 7.2-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ - && echo "deb http://ftp.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - certbot \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mariadb-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython-dev \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="--lts" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ -&& echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ -&& echo "deb http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-org-tools \ - mongodb-org-shell \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- drush7 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush7 \ -&& cd /usr/local/src/drush7 \ -&& git checkout 7.4.0 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush7 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush7 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush7/drush /usr/local/bin/drush7 \ -&& rm -rf /usr/local/src/drush7/.git \ -&& rm -rf /usr/local/src/drush7/docs \ -&& rm -rf /usr/local/src/drush7/examples \ -&& rm -rf /usr/local/src/drush7/misc \ - \ - \ -# -------------------- drush8 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush8 \ -&& cd /usr/local/src/drush8 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/8[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush8 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush8 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush8/drush /usr/local/bin/drush8 \ -&& rm -rf /usr/local/src/drush8/.git \ -&& rm -rf /usr/local/src/drush8/docs \ -&& rm -rf /usr/local/src/drush8/examples \ -&& rm -rf /usr/local/src/drush8/misc \ - \ - \ -# -------------------- drush9 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush9 \ -&& cd /usr/local/src/drush9 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/9[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush9 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush9 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress' \ -&& ln -s /usr/local/src/drush9/drush /usr/local/bin/drush9 \ -&& rm -rf /usr/local/src/drush9/.git \ -&& rm -rf /usr/local/src/drush9/docs \ -&& rm -rf /usr/local/src/drush9/examples \ -&& rm -rf /usr/local/src/drush9/misc \ - \ - \ -# -------------------- drupalconsole -------------------- - && DURL="$(curl -s https://api.github.com/repos/hechoendrupal/drupal-console-launcher/releases/latest | awk -F\" '/download.*.phar/{print $(NF-1)}' | head -1)" \ - && curl -sS -L --fail "${DURL}" -L -o /usr/local/bin/drupal \ - && chmod +x /usr/local/bin/drupal \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- laravel -------------------- - && git clone https://github.com/laravel/installer /usr/local/src/laravel-installer \ -&& cd /usr/local/src/laravel-installer \ -&& git checkout v4.0.0 \ - \ - && 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ -&& rm -rf /usr/local/src/laravel-installer/laravel/.git \ - \ - && ln -s /usr/local/src/laravel-installer/bin/laravel /usr/local/bin/laravel \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phalcon -------------------- - && 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) \ -&& COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer install \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/phalcon-devtools \ -&& su - ${MY_USER} -c 'cd /usr/local/src/phalcon-devtools && ./phalcon.sh' \ -&& ln -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ -&& chmod +x phalcon \ -&& cd / \ -&& rm -rf /usr/local/src/phalcon-devtools/.git \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- phpunit -------------------- - && curl -sS -k -L --fail https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit \ -&& chmod +x /usr/local/bin/phpunit \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases | awk -F\" '/wkhtmltopdf.*.stretch_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont2 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ -# -------------------- asgardcms -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer \ - && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ - \ -# -------------------- codeception -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \ - && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ - \ -# -------------------- lumen -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \ - && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ - \ -# -------------------- prestissimo -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.2' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '7.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '7.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && drush7 --version | grep -E '7[.0-9]+\s*$' \ - && drush8 --version | grep -E '8[.0-9]+\s*$' \ - && drush9 --version | grep -E '9[.0-9]+\s*$' \ - && drupal --version | grep -E 'Drupal Console Launcher\s*[0-9][.0-9]' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phalcon commands | grep -E '[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' \ - && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' \ - && lumen --version 2>/dev/null | grep -E '^Lumen Installer\s[0-9][.0-9]+$' \ - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-7.2.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-7.2.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -880,19 +1064,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-7.3 b/Dockerfiles/work/Dockerfile-7.3 index 19efe7c..f9da98c 100644 --- a/Dockerfiles/work/Dockerfile-7.3 +++ b/Dockerfiles/work/Dockerfile-7.3 @@ -1,8 +1,1043 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:7.3-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:7.3-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython3-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + python3-distutils \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="--lts" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:7.3-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + python3-distutils \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.3' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache asgardcms/asgardcms-installer:dev-master \ + && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mdl \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/bin/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/lumen-installer \ + && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache phalcon/devtools \ + && ln -s /usr/local/src/composer/vendor/phalcon/devtools/phalcon /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && OS_RELEASE="bullseye" \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.3' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,858 +1057,6 @@ LABEL "org.opencontainers.image.ref.name"="7.3-work" LABEL "org.opencontainers.image.title"="PHP-FPM 7.3-work" LABEL "org.opencontainers.image.description"="PHP-FPM 7.3-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ - && echo "deb http://ftp.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - certbot \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mariadb-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython3-dev \ - python3-distutils \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="--lts" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ -&& echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ -&& echo "deb http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-org-tools \ - mongodb-org-shell \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- drush7 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush7 \ -&& cd /usr/local/src/drush7 \ -&& git checkout 7.4.0 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush7 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush7 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush7/drush /usr/local/bin/drush7 \ -&& rm -rf /usr/local/src/drush7/.git \ -&& rm -rf /usr/local/src/drush7/docs \ -&& rm -rf /usr/local/src/drush7/examples \ -&& rm -rf /usr/local/src/drush7/misc \ - \ - \ -# -------------------- drush8 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush8 \ -&& cd /usr/local/src/drush8 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/8[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush8 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush8 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush8/drush /usr/local/bin/drush8 \ -&& rm -rf /usr/local/src/drush8/.git \ -&& rm -rf /usr/local/src/drush8/docs \ -&& rm -rf /usr/local/src/drush8/examples \ -&& rm -rf /usr/local/src/drush8/misc \ - \ - \ -# -------------------- drush9 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush9 \ -&& cd /usr/local/src/drush9 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/9[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush9 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush9 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress' \ -&& ln -s /usr/local/src/drush9/drush /usr/local/bin/drush9 \ -&& rm -rf /usr/local/src/drush9/.git \ -&& rm -rf /usr/local/src/drush9/docs \ -&& rm -rf /usr/local/src/drush9/examples \ -&& rm -rf /usr/local/src/drush9/misc \ - \ - \ -# -------------------- drupalconsole -------------------- - && DURL="$(curl -s https://api.github.com/repos/hechoendrupal/drupal-console-launcher/releases/latest | awk -F\" '/download.*.phar/{print $(NF-1)}' | head -1)" \ - && curl -sS -L --fail "${DURL}" -L -o /usr/local/bin/drupal \ - && chmod +x /usr/local/bin/drupal \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- laravel -------------------- - && 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ -&& rm -rf /usr/local/src/laravel-installer/laravel/.git \ - \ - && ln -s /usr/local/src/laravel-installer/bin/laravel /usr/local/bin/laravel \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phalcon -------------------- - && 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) \ -&& COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer install \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/phalcon-devtools \ -&& su - ${MY_USER} -c 'cd /usr/local/src/phalcon-devtools && ./phalcon.sh' \ -&& ln -sf /usr/local/src/phalcon-devtools/phalcon /usr/local/bin/phalcon \ -&& chmod +x phalcon \ -&& cd / \ -&& rm -rf /usr/local/src/phalcon-devtools/.git \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- phpunit -------------------- - && curl -sS -k -L --fail https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit \ -&& chmod +x /usr/local/bin/phpunit \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases | awk -F\" '/wkhtmltopdf.*.stretch_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont2 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ -# -------------------- asgardcms -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer \ - && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ - \ -# -------------------- codeception -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \ - && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ - \ -# -------------------- lumen -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \ - && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ - \ -# -------------------- prestissimo -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.3' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '7.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '7.3' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && drush7 --version | grep -E '7[.0-9]+\s*$' \ - && drush8 --version | grep -E '8[.0-9]+\s*$' \ - && drush9 --version | grep -E '9[.0-9]+\s*$' \ - && drupal --version | grep -E 'Drupal Console Launcher\s*[0-9][.0-9]' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phalcon commands | grep -E '[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' \ - && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' \ - && lumen --version 2>/dev/null | grep -E '^Lumen Installer\s[0-9][.0-9]+$' \ - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-7.3.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-7.3.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -881,19 +1064,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-7.4 b/Dockerfiles/work/Dockerfile-7.4 index e121f33..3bc68e6 100644 --- a/Dockerfiles/work/Dockerfile-7.4 +++ b/Dockerfiles/work/Dockerfile-7.4 @@ -1,8 +1,1043 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:7.4-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:7.4-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython3-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + python3-distutils \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="--lts" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:7.4-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + python3-distutils \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.4' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache asgardcms/asgardcms-installer:dev-master \ + && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mdl \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/bin/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/lumen-installer \ + && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache phalcon/devtools \ + && ln -s /usr/local/src/composer/vendor/phalcon/devtools/phalcon /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v3.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && OS_RELEASE="bullseye" \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.4' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,843 +1057,6 @@ LABEL "org.opencontainers.image.ref.name"="7.4-work" LABEL "org.opencontainers.image.title"="PHP-FPM 7.4-work" LABEL "org.opencontainers.image.description"="PHP-FPM 7.4-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ - && echo "deb http://ftp.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - certbot \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mariadb-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython3-dev \ - python3-distutils \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="--lts" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ -&& echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ -&& echo "deb http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-org-tools \ - mongodb-org-shell \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- drush7 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush7 \ -&& cd /usr/local/src/drush7 \ -&& git checkout 7.4.0 \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush7 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush7 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush7/drush /usr/local/bin/drush7 \ -&& rm -rf /usr/local/src/drush7/.git \ -&& rm -rf /usr/local/src/drush7/docs \ -&& rm -rf /usr/local/src/drush7/examples \ -&& rm -rf /usr/local/src/drush7/misc \ - \ - \ -# -------------------- drush8 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush8 \ -&& cd /usr/local/src/drush8 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/8[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush8 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush8 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress --no-dev' \ -&& ln -s /usr/local/src/drush8/drush /usr/local/bin/drush8 \ -&& rm -rf /usr/local/src/drush8/.git \ -&& rm -rf /usr/local/src/drush8/docs \ -&& rm -rf /usr/local/src/drush8/examples \ -&& rm -rf /usr/local/src/drush8/misc \ - \ - \ -# -------------------- drush9 -------------------- - && git clone https://github.com/drush-ops/drush.git /usr/local/src/drush9 \ -&& cd /usr/local/src/drush9 \ -&& git checkout $( git for-each-ref --format='%(*creatordate:raw)%(creatordate:raw) %(refname)' refs/tags | sort -n | grep -E 'tags/9[.0-9]+$' | tail -1 | sed 's|.*/||g' ) \ - \ - && chown -R ${MY_USER}:${MY_GROUP} /usr/local/src/drush9 \ -&& su - ${MY_USER} -c 'PATH=/usr/local/bin:$PATH; cd /usr/local/src/drush9 && COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 install --no-interaction --no-progress' \ -&& ln -s /usr/local/src/drush9/drush /usr/local/bin/drush9 \ -&& rm -rf /usr/local/src/drush9/.git \ -&& rm -rf /usr/local/src/drush9/docs \ -&& rm -rf /usr/local/src/drush9/examples \ -&& rm -rf /usr/local/src/drush9/misc \ - \ - \ -# -------------------- drupalconsole -------------------- - && DURL="$(curl -s https://api.github.com/repos/hechoendrupal/drupal-console-launcher/releases/latest | awk -F\" '/download.*.phar/{print $(NF-1)}' | head -1)" \ - && curl -sS -L --fail "${DURL}" -L -o /usr/local/bin/drupal \ - && chmod +x /usr/local/bin/drupal \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- laravel -------------------- - && 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ -&& rm -rf /usr/local/src/laravel-installer/laravel/.git \ - \ - && ln -s /usr/local/src/laravel-installer/bin/laravel /usr/local/bin/laravel \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v3.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- phpunit -------------------- - && curl -sS -k -L --fail https://phar.phpunit.de/phpunit-7.phar > /usr/local/bin/phpunit \ -&& chmod +x /usr/local/bin/phpunit \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases | awk -F\" '/wkhtmltopdf.*.stretch_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont2 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ -# -------------------- asgardcms -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer \ - && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ - \ -# -------------------- codeception -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \ - && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ - \ -# -------------------- lumen -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \ - && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ - \ -# -------------------- prestissimo -------------------- - && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^7.4' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '7.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '7.4' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && drush7 --version | grep -E '7[.0-9]+\s*$' \ - && drush8 --version | grep -E '8[.0-9]+\s*$' \ - && drush9 --version | grep -E '9[.0-9]+\s*$' \ - && drupal --version | grep -E 'Drupal Console Launcher\s*[0-9][.0-9]' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' \ - && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' \ - && lumen --version 2>/dev/null | grep -E '^Lumen Installer\s[0-9][.0-9]+$' \ - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-7.4.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-7.4.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -866,19 +1064,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-8.0 b/Dockerfiles/work/Dockerfile-8.0 index b390436..f0f070b 100644 --- a/Dockerfiles/work/Dockerfile-8.0 +++ b/Dockerfiles/work/Dockerfile-8.0 @@ -1,8 +1,1043 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:8.0-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:8.0-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython3-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + python3-distutils \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="--lts" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:8.0-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + python3-distutils \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.0' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache asgardcms/asgardcms-installer:dev-master \ + && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mdl \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/bin/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/lumen-installer \ + && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache phalcon/devtools \ + && ln -s /usr/local/src/composer/vendor/phalcon/devtools/phalcon /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v3.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && OS_RELEASE="bullseye" \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.0' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,768 +1057,6 @@ LABEL "org.opencontainers.image.ref.name"="8.0-work" LABEL "org.opencontainers.image.title"="PHP-FPM 8.0-work" LABEL "org.opencontainers.image.description"="PHP-FPM 8.0-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ - && echo "deb http://ftp.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - certbot \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mariadb-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython3-dev \ - python3-distutils \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="--lts" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ -&& echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ -&& echo "deb http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-org-tools \ - mongodb-org-shell \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- laravel -------------------- - && 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ -&& rm -rf /usr/local/src/laravel-installer/laravel/.git \ - \ - && ln -s /usr/local/src/laravel-installer/bin/laravel /usr/local/bin/laravel \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v3.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases | awk -F\" '/wkhtmltopdf.*.stretch_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont2 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.0' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '8.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '8.0' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-8.0.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-8.0.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -791,19 +1064,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-8.1 b/Dockerfiles/work/Dockerfile-8.1 index 518b713..94a2038 100644 --- a/Dockerfiles/work/Dockerfile-8.1 +++ b/Dockerfiles/work/Dockerfile-8.1 @@ -1,8 +1,1043 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:8.1-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:8.1-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython3-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + python3-distutils \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="--lts" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:8.1-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + python3-distutils \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.1' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache asgardcms/asgardcms-installer:dev-master \ + && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mdl \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/bin/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/lumen-installer \ + && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache phalcon/devtools \ + && ln -s /usr/local/src/composer/vendor/phalcon/devtools/phalcon /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v3.phar" \ + && curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer \ + && chmod +x /usr/local/bin/php-cs-fixer \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && OS_RELEASE="bullseye" \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (composer) phalcon-devtools -------------------- +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + && true + +# -------------------- (custom) php-cs-fixer -------------------- +RUN set -eux \ + && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.1' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,768 +1057,6 @@ LABEL "org.opencontainers.image.ref.name"="8.1-work" LABEL "org.opencontainers.image.title"="PHP-FPM 8.1-work" LABEL "org.opencontainers.image.description"="PHP-FPM 8.1-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ - && echo "deb http://ftp.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - certbot \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mariadb-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython3-dev \ - python3-distutils \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="--lts" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ -&& echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ -&& echo "deb http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-org-tools \ - mongodb-org-shell \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- laravel -------------------- - && 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_MEMORY_LIMIT=-1 /usr/local/bin/composer install --no-interaction --no-progress --no-dev' \ -&& rm -rf /usr/local/src/laravel-installer/laravel/.git \ - \ - && ln -s /usr/local/src/laravel-installer/bin/laravel /usr/local/bin/laravel \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- php-cs-fixer -------------------- - && curl -sS -k -L --fail https://cs.symfony.com/download/php-cs-fixer-v3.phar > /usr/local/bin/php-cs-fixer \ -&& chmod +x /usr/local/bin/php-cs-fixer \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases | awk -F\" '/wkhtmltopdf.*.stretch_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont2 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.1' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '8.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '8.1' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && laravel --version | grep -E '(Installer|version)\s*[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-8.1.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-8.1.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -791,19 +1064,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Dockerfiles/work/Dockerfile-8.2 b/Dockerfiles/work/Dockerfile-8.2 index 9e94aba..5d7557b 100644 --- a/Dockerfiles/work/Dockerfile-8.2 +++ b/Dockerfiles/work/Dockerfile-8.2 @@ -1,8 +1,969 @@ +# vi: ft=dockerfile # Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-work.j2 instead. -FROM devilbox/php-fpm:8.2-prod -MAINTAINER "cytopia" -ARG ARCH +######################################################################################################################## +######################################################################################################################## +### +### Stage 1/7: Devilbox work image (HELP BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### Installs all cli tools required to install custom tools +### +FROM devilbox/php-fpm:8.2-slim as devilbox-work-help-builder + +### +### Install build_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + libpython3-dev \ + && rm -rf /var/lib/apt/lists/* +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + python3-distutils \ + unzip \ + && rm -rf /var/lib/apt/lists/* +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && COMPOSER_1_VERSION="latest-1.x" \ + && COMPOSER_2_VERSION="latest-2.x" \ + \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ + && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ + && chmod +x /usr/local/bin/composer-1 \ + && chmod +x /usr/local/bin/composer-2 \ + \ + && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ + \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && NODE_VERSION="--lts" \ + \ + && NVM_VERSION="$( \ + curl -sS 'https://github.com/nvm-sh/nvm/releases' \ + | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ + | grep -Eo 'v?[.0-9]+' \ + | sort -V \ + | tail -1 \ + )" \ + && mkdir -p /opt/nvm \ + && curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ + | NVM_DIR="/opt/nvm" bash \ + \ + && chown -R devilbox:devilbox "/opt/nvm" \ + \ + && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ + && su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ + \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/corepack" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/node" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npm" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/npx" /usr/local/bin/ \ + && ln -s "/opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/yarn" /usr/local/bin/ \ + \ + && chmod 0777 /opt/nvm \ + && find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ + && find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ + \ + && rm -rf /opt/nvm/.cache \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/share \ + && rm -rf /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/include \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ + \ + && /bin/ls -1 /usr/local/lib/ | grep ^python | while read -r version; do \ + cd "/usr/local/lib/${version}/" \ + && find . -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '*.exe' -print0 | xargs -0 -n1 rm -rf \ + && find . -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \ + \ + && if [ -d "dist-packages" ]; then \ + cd "dist-packages" \ + && pwd \ + && if /bin/ls -1 | grep -v '^pip'; then \ + /bin/ls -1 | grep -v '^pip' | xargs -n1 rm -rf; \ + fi \ + fi \ + done \ + \ + && true + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 2/7: Devilbox work image (HELP) +### +######################################################################################################################## +######################################################################################################################## + +### +### Copies all cli tools required to run Devilbox and its intranet into a clean image +### +FROM devilbox/php-fpm:8.2-slim as devilbox-work-help + +### +### Install run_dep +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + python3-distutils \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy nvm +### +COPY --from=devilbox-work-help-builder /opt/nvm /opt/nvm + +### +### Copy binaries (Composer & Pip binaries) +### +COPY --from=devilbox-work-help-builder /usr/local/bin /usr/local/bin + +### +### Python packages +### +COPY --from=devilbox-work-help-builder /usr/local/lib /usr/local/lib + + +### +### Configure Bash (composer, node yarn) +### +RUN set -eux \ + && { \ + #echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ + echo; \ + echo "# [Devilbox] Ensure yarn, composer and node are in PATH"; \ + echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ + echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ + echo 'PATH="/opt/nvm/versions/node/$(node --version)/bin:${PATH}"'; \ + echo "export PATH"; \ + echo; \ + echo "# [Devilbox] Ensure to load nvm"; \ + echo 'export NVM_DIR="/opt/nvm"'; \ + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ + echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ + #echo; \ + #echo ". /etc/bash-devilbox"; \ + #echo; \ + #echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ + #echo " for f in /etc/bashrc-devilbox.d/*.sh ; do"; \ + #echo " if [ -r \"\${f}\" ]; then"; \ + #echo " . \"\${f}\""; \ + #echo " fi"; \ + #echo " done"; \ + #echo " unset f"; \ + #echo "fi"; \ + } | tee -a /home/${MY_USER}/.bashrc /root/.bashrc \ + && chown ${MY_USER}:${MY_GROUP} /home/${MY_USER}/.bashrc + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 3/7: Devilbox work image (HELP TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-help as devilbox-work-help-test + +### +### Devilbox required helper tools from group_vars (work-help.yml) +### + +# -------------------- composer -------------------- +RUN set -eux \ + && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ + && true + +# -------------------- nvm -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; node --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + && su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ + \ + && true + +# -------------------- pip -------------------- +RUN set -eux \ + && pip --version \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.2' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 4/7: Devilbox work image (TOOLS BUILDER) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools-builder + +### +### Install build_dep, run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- build_deps ---------- + ruby-dev \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Install defined php_tools +### + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @angular/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/ng /usr/local/bin/ \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache asgardcms/asgardcms-installer:dev-master \ + && ln -s /usr/local/src/composer/vendor/asgardcms/asgardcms-installer/asgardcms /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global eslint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/eslint /usr/local/bin/ \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global jsonlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/jsonlint /usr/local/bin/ \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && gem install mdl \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache codeception/codeception \ + && ln -s /usr/local/src/composer/vendor/codeception/codeception/codecept /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ + && chmod +x /usr/local/bin/dep \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ + \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global grunt-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/grunt /usr/local/bin/ \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global gulp' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/gulp /usr/local/bin/ \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/installer \ + && ln -s /usr/local/src/composer/vendor/laravel/installer/bin/laravel /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require --no-interaction --no-cache laravel/lumen-installer \ + && ln -s /usr/local/src/composer/vendor/laravel/lumen-installer/lumen /usr/local/bin/ \ + && rm -rf /usr/local/src/composer/cache/* \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck \ + && chmod +x /usr/local/bin/linkcheck \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global mdlint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/mdlint /usr/local/bin/ \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" \ + && curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf \ + && chmod +x /usr/local/bin/phpcbf \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" \ + && curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs \ + && chmod +x /usr/local/bin/phpcs \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd \ + && chmod +x /usr/local/bin/phpmd \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && PHP_UNIT_VERSION="" \ + && if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + \ + && chmod +x /usr/local/bin/phpunit \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global pm2' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/pm2 /usr/local/bin/ \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall pwncat \ + && ln -s pwncat /usr/local/bin/netcat \ + \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global sass' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/sass /usr/local/bin/ \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global stylelint' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/stylelint /usr/local/bin/ \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global @vue/cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/vue /usr/local/bin/ \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && su -c '. /opt/nvm/nvm.sh; npm install --location=global webpack-cli' devilbox \ + && ln -s /opt/nvm/versions/node/$(su -c '. /opt/nvm/nvm.sh; node --version' devilbox)/bin/webpack-cli /usr/local/bin/ \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && OS_RELEASE="bullseye" \ + && DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" \ + && curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp \ + && chmod +x /usr/local/bin/wp \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yamllint \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && pip install --no-cache-dir --no-compile --force-reinstall yq \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Post fixes +### +RUN set -eux \ + && if [ ! -d "/var/lib/gems" ]; then \ + mkdir "/var/lib/gems"; \ + fi + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 5/7: Devilbox work image (TOOLS) +### +######################################################################################################################## +######################################################################################################################## + +### +### This stage can be easily modified by adding tools into the ./php_tools/ directory. +### +FROM devilbox-work-help as devilbox-work-tools + +### +### Install run_dep or tools type: apt +### +RUN set -eux \ + && DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + # ---------- run_deps ---------- + dos2unix \ + file \ + fontconfig \ + libfontenc1 \ + libxfont2 \ + libxrender1 \ + moreutils \ + ruby \ + xfonts-75dpi \ + xfonts-base \ + xfonts-encodings \ + xfonts-utils \ + # ---------- type: apt ---------- + git \ + jq \ + mupdf-tools \ + openssh-client \ + rsync \ + shellcheck \ + subversion \ + tig \ + vim \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +### +### Copy Custom (binaries in /usr/local/bin) +### +COPY --from=devilbox-work-tools-builder /usr/local/bin /usr/local/bin + +### +### Copy NPM +### +COPY --from=devilbox-work-tools-builder /opt/nvm /opt/nvm + +### +### Copy Composer +### +COPY --from=devilbox-work-tools-builder /usr/local/src /usr/local/src + +### +### Copy Pip +### +COPY --from=devilbox-work-tools-builder /usr/local/lib /usr/local/lib + +### +### Copy RubyGems +### +COPY --from=devilbox-work-tools-builder /var/lib/gems /var/lib/gems + + +# FIXME: / TODO: Add post: stage into here as well + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 6/7: Devilbox work image (TOOLS TEST) +### +######################################################################################################################## +######################################################################################################################## + +### +### Test all Devilbox cli utils if copying was successful +### +FROM devilbox-work-tools as devilbox-work-tools-test + + +# -------------------- (npm) angular-cli -------------------- +RUN set -eux \ + && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) \ + && true + +# -------------------- (composer) asgardcms -------------------- +RUN set -eux \ + && asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) \ + && true + +# -------------------- (npm) eslint -------------------- +RUN set -eux \ + && eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) \ + && true + +# -------------------- (apt) git -------------------- +RUN set -eux \ + && git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) \ + && true + +# -------------------- (npm) jsonlint -------------------- +RUN set -eux \ + && jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) \ + && true + +# -------------------- (rubygem) mdl -------------------- +RUN set -eux \ + && mdl --version | grep -E '[.0-9]+' || (mdl --version; false) \ + && true + +# -------------------- (custom) awesome-ci -------------------- +RUN set -eux \ + && regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) \ + && true + +# -------------------- (composer) codeception -------------------- +RUN set -eux \ + && codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) \ + && true + +# -------------------- (custom) deployer -------------------- +RUN set -eux \ + && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) \ + && true + +# -------------------- (custom) git-flow -------------------- +RUN set -eux \ + && git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) \ + && true + +# -------------------- (npm) grunt-cli -------------------- +RUN set -eux \ + && grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) \ + && true + +# -------------------- (npm) gulp -------------------- +RUN set -eux \ + && gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) \ + && true + +# -------------------- (apt) jq -------------------- +RUN set -eux \ + && jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) \ + && true + +# -------------------- (composer) laravel-installer -------------------- +RUN set -eux \ + && laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) \ + && true + +# -------------------- (composer) laravel-lumen -------------------- +RUN set -eux \ + && lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) \ + && true + +# -------------------- (custom) linkcheck -------------------- +RUN set -eux \ + && linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) \ + && true + +# -------------------- (npm) mdlint -------------------- +RUN set -eux \ + && mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) \ + && true + +# -------------------- (apt) mupdf-tools -------------------- +RUN set -eux \ + && PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + \ + && true + +# -------------------- (custom) phpcbf -------------------- +RUN set -eux \ + && phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) \ + && true + +# -------------------- (custom) phpcs -------------------- +RUN set -eux \ + && phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) \ + && true + +# -------------------- (custom) phpmd -------------------- +RUN set -eux \ + && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) \ + && true + +# -------------------- (custom) phpunit -------------------- +RUN set -eux \ + && phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \ + && true + +# -------------------- (npm) pm2 -------------------- +RUN set -eux \ + && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) \ + && true + +# -------------------- (pip) pwncat -------------------- +RUN set -eux \ + && pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \ + && true + +# -------------------- (apt) ssh -------------------- +RUN set -eux \ + && ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) \ + && true + +# -------------------- (apt) rsync -------------------- +RUN set -eux \ + && rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) \ + && true + +# -------------------- (npm) sass -------------------- +RUN set -eux \ + && sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) \ + && true + +# -------------------- (apt) shellcheck -------------------- +RUN set -eux \ + && shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) \ + && true + +# -------------------- (npm) stylelint -------------------- +RUN set -eux \ + && stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) \ + && true + +# -------------------- (apt) svn -------------------- +RUN set -eux \ + && svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) \ + && true + +# -------------------- (custom) symfony-cli -------------------- +RUN set -eux \ + && symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) \ + && true + +# -------------------- (custom) taskfile -------------------- +RUN set -eux \ + && task --version | grep -E '[0-9][.0-9]+' || (task --version; false) \ + && true + +# -------------------- (apt) tig -------------------- +RUN set -eux \ + && tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) \ + && true + +# -------------------- (apt) vim -------------------- +RUN set -eux \ + && vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) \ + && true + +# -------------------- (npm) vue-cli -------------------- +RUN set -eux \ + && vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) \ + && true + +# -------------------- (npm) webpack-cli -------------------- +RUN set -eux \ + && webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) \ + && true + +# -------------------- (custom) wkhtmltopdf -------------------- +RUN set -eux \ + && wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) \ + && true + +# -------------------- (custom) wp-cli -------------------- +RUN set -eux \ + && wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) \ + && true + +# -------------------- (pip) yamllint -------------------- +RUN set -eux \ + && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) \ + && true + +# -------------------- (pip) yq -------------------- +RUN set -eux \ + && yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) \ + && true + +# -------------------- (apt) zsh -------------------- +RUN set -eux \ + && zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) \ + && true + +### +### Re-activate modules which have been deactivated in mods (for testing). +### +RUN set -eux \ + && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi + +### +### Check if PHP still works +### +RUN set -eux \ + && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ + && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.2' \ + && /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 \ + && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ + \ + && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ + && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ + && rm -f /usr/local/etc/php/php.ini + + + +######################################################################################################################## +######################################################################################################################## +### +### Stage 7/7: Devilbox sliwork image (FINAL) +### +######################################################################################################################## +######################################################################################################################## + +### +### Prepare final base image (STAGE: work) +### +FROM devilbox-work-tools as work +MAINTAINER "cytopia" ### ### Labels @@ -22,750 +983,6 @@ LABEL "org.opencontainers.image.ref.name"="8.2-work" LABEL "org.opencontainers.image.title"="PHP-FPM 8.2-work" LABEL "org.opencontainers.image.description"="PHP-FPM 8.2-work" - -### -### Re-activate modules which have been deactivated in mods. -### NOTE: They will be removed at the very bottom -### -RUN set -eux \ - && if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ - echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ - fi \ - && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ - echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ - fi - - -### -### Envs -### -ENV BASH_PROFILE=".bashrc" - - -### -### Install Tools -### -RUN set -eux \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - apt-transport-https \ - ca-certificates \ - curl \ - dirmngr \ - gnupg \ - \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \ - && echo "deb http://ftp.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list \ - && curl -sS -L --fail "https://packages.blackfire.io/gpg.key" | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list \ - \ - && DEBIAN_FRONTEND=noninteractive apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - ack-grep \ - aspell \ - autoconf \ - automake \ - bash-completion \ - binutils \ - blackfire-agent \ - build-essential \ - bzip2 \ - certbot \ - coreutils \ - dnsutils \ - dos2unix \ - file \ - gawk \ - gcc \ - git \ - git-flow \ - git-svn \ - ghostscript \ - graphviz \ - gsfonts \ - hostname \ - htop \ - imagemagick \ - iputils-ping \ - jq \ - less \ - libc-dev \ - libffi-dev \ - libssl-dev \ - libyaml-dev \ - locales \ - make \ - moreutils \ - \ - mariadb-client \ - \ - mupdf \ - mupdf-tools \ - nano \ - net-tools \ - netcat \ - openssh-client \ - patch \ - patchelf \ - redis-tools \ - rsync \ - rubygems \ - ruby-dev \ - shellcheck \ - silversearcher-ag \ - sqlite3 \ - subversion \ - sudo \ - tig \ - tree \ - unzip \ - vim \ - w3m \ - wget \ - whois \ - xz-utils \ - zip \ - zlib1g-dev \ - zsh \ - && rm -rf /var/lib/apt/lists/* \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install custom software -### -RUN set -eux \ -# -------------------- composer -------------------- - && COMPOSER_1_VERSION="latest-1.x" \ -&& COMPOSER_2_VERSION="latest-2.x" \ - \ - && curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_1_VERSION}/composer.phar" > /usr/local/bin/composer-1 \ -&& curl -sS -L --fail "https://getcomposer.org/download/${COMPOSER_2_VERSION}/composer.phar" > /usr/local/bin/composer-2 \ -&& chmod +x /usr/local/bin/composer-1 \ -&& chmod +x /usr/local/bin/composer-2 \ - \ - && ln -sf /usr/local/bin/composer-2 /usr/local/bin/composer \ - \ - \ -# -------------------- pip -------------------- - && DEBIAN_FRONTEND=noninteractive apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libpython3-dev \ - python3-distutils \ -&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ -&& rm -rf /var/lib/apt/lists/* \ -\ -&& curl -sS -L --fail https://bootstrap.pypa.io/get-pip.py | python3 \ - \ - \ -# -------------------- nvm -------------------- - && NODE_VERSION="--lts" \ - \ - && NVM_VERSION="$( \ - curl -sS 'https://github.com/nvm-sh/nvm/releases' \ - | grep -Eo '/nvm-sh/nvm/releases/tag/v?[.0-9]+"' \ - | grep -Eo 'v?[.0-9]+' \ - | sort -V \ - | tail -1 \ -)" \ -&& mkdir -p /opt/nvm \ -&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" \ - | NVM_DIR="/opt/nvm" bash \ -\ -&& { \ - echo 'export NVM_DIR="/opt/nvm"'; \ - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm'; \ - echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion'; \ -} >> /home/devilbox/.bashrc \ -\ -&& chown -R devilbox:devilbox "/opt/nvm" \ - \ - && su -c ". /opt/nvm/nvm.sh; nvm install ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; nvm use ${NODE_VERSION}" devilbox \ -&& su -c ". /opt/nvm/nvm.sh; corepack enable" devilbox \ -\ -&& chmod 0777 /opt/nvm \ -&& find /opt/nvm -type f -print0 | xargs -n1 -0 chmod go+w \ -&& find /opt/nvm -type d -print0 | xargs -n1 -0 chmod 0777 \ - \ - \ -# -------------------- pgsql_client -------------------- - && curl -sS -k -L --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ -&& echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgsql.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - postgresql-client \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- mongo_client -------------------- - && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691EEC35216C63CAF66CE1656408E390CFB1F5 \ -&& echo "deb http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongo.list \ -&& apt-get update \ - \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - mongodb-org-tools \ - mongodb-org-shell \ - \ - && rm -rf /var/lib/apt/lists/* \ - \ -# -------------------- awesomeci -------------------- - && 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 \ - \ - \ -# -------------------- deployer -------------------- - && curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep \ - && chmod +x /usr/local/bin/dep \ - \ -# -------------------- gitflow -------------------- - && git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ -&& cd /tmp/gitflow \ -&& make install \ -&& cd / && rm -rf /tmp/gitflow \ - \ - \ -# -------------------- linkcheck -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck > /usr/local/bin/linkcheck \ -&& chmod +x /usr/local/bin/linkcheck \ - \ - \ -# -------------------- mhsendmail -------------------- - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - curl -sS -L --fail https://github.com/devilbox/mhsendmail/releases/download/v0.3.0/mhsendmail_linux_amd64 > mhsendmail_linux_amd64 \ - && chmod +x mhsendmail_linux_amd64 \ - && mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail; \ -fi \ - \ - \ -# -------------------- mysqldumpsecure -------------------- - && 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 \ - \ - \ -# -------------------- phpcs -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs \ -&& chmod +x /usr/local/bin/phpcs \ - \ - \ -# -------------------- phpcbf -------------------- - && curl -sS -L --fail https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf \ -&& chmod +x /usr/local/bin/phpcbf \ - \ - \ -# -------------------- phpmd -------------------- - && curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar > phpmd.phar \ -&& mv phpmd.phar /usr/local/bin/phpmd \ -&& chmod +x /usr/local/bin/phpmd \ - \ - \ -# -------------------- symfony -------------------- - && VERSION="$(curl -s https://api.github.com/repos/symfony-cli/symfony-cli/releases/latest | awk -F\" '/symfony-cli_.*._amd64\.deb/{print $(NF-1)}' | head -1 | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" \ - && curl -sS -L --fail -o /tmp/symfonycli.deb https://github.com/symfony-cli/symfony-cli/releases/download/v${VERSION}/symfony-cli_${VERSION}_$(dpkg-architecture --query DEB_HOST_ARCH).deb \ -&& dpkg -i /tmp/symfonycli.deb \ -&& rm -f /tmp/symfonycli.deb \ - \ - \ -# -------------------- wkhtmltopdf -------------------- - && VERSION="$(curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases | awk -F\" '/wkhtmltopdf.*.stretch_amd64\.deb/{print $(NF-1)}' | head -1 )" \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \ - libfontenc1 libxfont2 xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils \ - && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb ${VERSION} \ - && dpkg -i /tmp/wkhtmltopdf.deb \ - && rm -f /tmp/wkhtmltopdf.deb; \ -fi \ - \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then \ - DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/*; \ -fi \ - \ - \ -# -------------------- wpcli -------------------- - && curl -sS -L --fail https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -L -o /usr/local/bin/wp \ - && chmod +x /usr/local/bin/wp \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /usr/local/src/composer/cache/* || true) \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -### -### Install Composer (PHP) -### -RUN set -eux \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install npm (Node) -### -RUN set -eux \ -# -------------------- angular_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @angular/cli' devilbox \ - \ -# -------------------- eslint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force eslint' devilbox \ - \ -# -------------------- grunt -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt' devilbox \ - \ -# -------------------- grunt_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force grunt-cli' devilbox \ - \ -# -------------------- gulp -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force gulp' devilbox \ - \ -# -------------------- jsonlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force jsonlint' devilbox \ - \ -# -------------------- pm2 -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force pm2' devilbox \ - \ -# -------------------- mdlint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force mdlint' devilbox \ - \ -# -------------------- sass -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force sass' devilbox \ - \ -# -------------------- stylelint -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force stylelint' devilbox \ - \ -# -------------------- vue_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli' devilbox \ - \ -# -------------------- vue_cli_service_global -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force @vue/cli-service-global' devilbox \ - \ -# -------------------- webpack -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack' devilbox \ - \ -# -------------------- webpack_cli -------------------- - && su -c '. /opt/nvm/nvm.sh; npm install -g --force webpack-cli' devilbox \ - \ - \ - \ - && if [ -f "/opt/nvm/nvm.sh" ]; then \ - ln -sf $(dirname $(su -c '. /opt/nvm/nvm.sh; nvm which current' devilbox))/* /usr/local/bin/ \ - \ - && su -c '. /opt/nvm/nvm.sh; npm cache clear --force' devilbox \ - && su -c '. /opt/nvm/nvm.sh; nvm cache clear --force' devilbox; \ - fi \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /opt/nvm -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install gem (Ruby) -### -RUN set -eux \ -# -------------------- mixlib_config -------------------- - && gem install mixlib-config -v 2.2.4 \ - \ -# -------------------- rb_inotify -------------------- - && gem install rb-inotify -v 0.9.10 \ - \ -# -------------------- mdl -------------------- - && gem install mdl -v 0.5.0 \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Install pip (Python) packages -### -RUN set -eux \ -# -------------------- yamllint -------------------- - && pip install --no-cache-dir --force-reinstall yamllint || true \ - \ -# -------------------- yq -------------------- - && pip install --no-cache-dir --force-reinstall yq || true \ - \ - \ - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) \ - \ - && (find /usr/local/bin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ - && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) - - -### -### Configure Bash -### -RUN \ - { \ - echo 'PATH="${PATH}:/usr/local/bin:/usr/local/sbin"'; \ - echo 'PATH="${HOME}/.yarn/bin:${PATH}"'; \ - echo 'PATH="${HOME}/.composer/vendor/bin:${PATH}"'; \ - echo 'PATH="/opt/nvm/versions/node/$(nvm version default)/bin:${PATH}"'; \ - echo "export PATH"; \ - echo ". /etc/bash-devilbox"; \ - echo "if [ -d /etc/bashrc-devilbox.d/ ]; then"; \ - echo " for f in /etc/bashrc-devilbox.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} - - -### -### Verify -### -RUN set -eux \ - && echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \ - && php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.2' \ - && /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 \ - && PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \ - \ - && PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \ - && if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \ - && rm -f /usr/local/etc/php/php.ini - -RUN set -eux \ -# -------------------- Software -------------------- - && composer --version 2>/dev/null | grep -Ei '(composer|version)\s*[0-9][.0-9]+' \ - && su -c '. /opt/nvm/nvm.sh; nvm --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ -&& su -c '. /opt/nvm/nvm.sh; yarn --version' devilbox | grep -E '^v?[0-9][.0-9]+' \ - \ - && if echo '8.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - pg_isready --version; \ - fi \ -else \ - pg_isready --version; \ -fi \ - \ - && if echo '8.2' | grep -E '^(5.2|5.3|5.4|5.5|5.6|7.0)$' >/dev/null; then \ - if [ "$(dpkg-architecture --query DEB_BUILD_ARCH)" = "amd64" ]; then \ - mongofiles --version; \ - fi \ -else \ - mongofiles --version; \ -fi \ - \ - && regex-grep --version | grep -E '[0-9][.0-9]+' \ - && dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' \ - && git-flow version | grep -E '[0-9][.0-9]+' \ - && linkcheck --version | grep -E '^linkcheck\sv[0-9][.0-9]+' \ - && mysqldump-secure --version | grep -E 'Version:\s*[0-9][.0-9]+' \ - && phpcs --version | grep -E 'version [0-9][.0-9]+' \ - && phpcbf --version | grep -E 'version [0-9][.0-9]+' \ - && phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' \ - && symfony -V | grep -Ei 'version\s[0-9][.0-9]+' \ - && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "amd64" ]; then wkhtmltopdf --version | grep -E "^wkhtmltopdf [0-9][.0-9]+\s+\(.+patched.+\)"; fi \ - && wp --allow-root --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Composer -------------------- - \ -# -------------------- PIP -------------------- - && yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' \ - && yq --version 2>&1 | grep -E '^yq\s+[0-9][.0-9]+$' \ - \ -# -------------------- NPM -------------------- - && ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' \ - && eslint -v | grep -E '[0-9][.0-9]+' \ - && grunt --version | grep -E '[0-9][.0-9]+' \ - && gulp --version | grep -E '[0-9][.0-9]+' \ - && jsonlint --version | grep -E '[0-9][.0-9]+' \ - && pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' \ - && mdlint --version | grep -E '[0-9][.0-9]+' \ - && sass --version | grep -E '[0-9][.0-9]+' \ - && stylelint --version | grep -E '[0-9][.0-9]+' \ - && vue --version | grep -E '[0-9][.0-9]+' \ - && webpack --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- GEM -------------------- - && mdl --version | grep -E '[0-9][.0-9]+' \ - \ -# -------------------- Cleanup -------------------- - \ - && (rm -rf /home/devilbox/.*json || true) \ - && (rm -rf /home/devilbox/.ansible || true) \ - && (rm -rf /home/devilbox/.cache || true) \ - && (rm -rf /home/devilbox/.composer || true) \ - && (rm -rf /home/devilbox/.config || true) \ - && (rm -rf /home/devilbox/.console || true) \ - && (rm -rf /home/devilbox/.drush || true) \ - && (rm -rf /home/devilbox/.gem || true) \ - && (rm -rf /home/devilbox/.local || true) \ - && (rm -rf /home/devilbox/.node || true) \ - && (rm -rf /home/devilbox/.npm || true) \ - && (rm -rf /home/devilbox/.pm2 || true) \ - && (rm -rf /home/devilbox/.subversion || true) \ - && (rm -rf /home/devilbox/.v8* || true) \ - && (rm -rf /home/devilbox/node_modules || true) \ - && (rm -rf /home/devilbox/yarn.lock || true) \ - \ - && (rm -rf /root/.*json || true) \ - && (rm -rf /root/.ansible || true) \ - && (rm -rf /root/.cache || true) \ - && (rm -rf /root/.composer || true) \ - && (rm -rf /root/.config || true) \ - && (rm -rf /root/.console || true) \ - && (rm -rf /root/.drush || true) \ - && (rm -rf /root/.gem || true) \ - && (rm -rf /root/.local || true) \ - && (rm -rf /root/.node || true) \ - && (rm -rf /root/.npm || true) \ - && (rm -rf /root/.pm2 || true) \ - && (rm -rf /root/.subversion || true) \ - && (rm -rf /root/.v8* || true) \ - && (rm -rf /root/node_modules || true) \ - && (rm -rf /root/yarn.lock || true) \ - \ - && (rm -rf /tmp/* || true) \ - && (rm -rf /tmp/.* || true) - - -# Deactive PSR and Phalcon: -# https://github.com/devilbox/docker-php-fpm/issues/201 -RUN set -eux \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini || true \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini || true \ - - -### -### Copy files -### -COPY ./data/php-ini.d/php-8.2.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini -COPY ./data/php-fpm.conf/php-fpm-8.2.conf /usr/local/etc/php-fpm.conf - -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 ### @@ -773,19 +990,16 @@ VOLUME /shared/backups VOLUME /var/log/php VOLUME /var/mail - ### ### Ports ### EXPOSE 9000 - ### ### Where to start inside the container ### WORKDIR /shared/httpd - ### ### Entrypoint ### diff --git a/Makefile b/Makefile index 0697568..df79f59 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ include $(MAKEFILES) # ------------------------------------------------------------------------------------------------- # Default configuration # ------------------------------------------------------------------------------------------------- +DOCKER_PULL_BASE_IMAGES_IGNORE = devilbox-slim-base devilbox-work-help devilbox-work-tools # Own vars TAG = latest @@ -37,12 +38,14 @@ DOCKER_TAG = $(VERSION)-$(STAGE) BASE_TAG = $(VERSION)-base MODS_TAG = $(VERSION)-mods PROD_TAG = $(VERSION)-prod +SLIM_TAG = $(VERSION)-slim WORK_TAG = $(VERSION)-work else DOCKER_TAG = $(VERSION)-$(STAGE)-$(TAG) BASE_TAG = $(VERSION)-base-$(TAG) MODS_TAG = $(VERSION)-mods-$(TAG) PROD_TAG = $(VERSION)-prod-$(TAG) +SLIM_TAG = $(VERSION)-slim-$(TAG) WORK_TAG = $(VERSION)-work-$(TAG) endif ARCH = linux/amd64 @@ -130,13 +133,13 @@ endif .PHONY: build build: check-stage-is-set build: check-parent-image-exists -build: ARGS+=--build-arg EXT_DIR=$(EXT_DIR) +build: ARGS+=--build-arg EXT_DIR=$(EXT_DIR) --build-arg ARCH=$(shell if [ "$(ARCH)" = "linux/amd64" ]; then echo "x86_64"; else echo "aarch64"; fi) build: docker-arch-build .PHONY: rebuild rebuild: check-stage-is-set rebuild: check-parent-image-exists -rebuild: ARGS+=--build-arg EXT_DIR=$(EXT_DIR) +rebuild: ARGS+=--build-arg EXT_DIR=$(EXT_DIR) --build-arg ARCH=$(shell if [ "$(ARCH)" = "linux/amd64" ]; then echo "x86_64"; else echo "aarch64"; fi) rebuild: docker-arch-rebuild .PHONY: push @@ -184,8 +187,8 @@ manifest-push: docker-manifest-push .PHONY: test test: check-stage-is-set test: check-current-image-exists -test: gen-readme test: test-integration +test: gen-readme .PHONY: test-integration test-integration: @@ -210,7 +213,7 @@ _gen-readme-docs: @echo "################################################################################" @echo "# Generate doc/php-modules.md for PHP $(VERSION) ($(IMAGE):$(DOCKER_TAG)) on $(ARCH)" @echo "################################################################################" - ./bin/gen-readme.sh $(IMAGE) $(ARCH) $(STAGE) $(VERSION) || bash -x ./bin/gen-readme.sh $(IMAGE) $(ARCH) $(STAGE) $(VERSION) + ./bin/gen-docs-php-modules.sh $(IMAGE) $(ARCH) $(STAGE) $(VERSION) || bash -x ./bin/gen-docs-php-modules.sh $(IMAGE) $(ARCH) $(STAGE) $(VERSION) git diff --quiet || { echo "Build Changes"; git diff; git status; false; } @echo @@ -231,18 +234,24 @@ _gen-readme-main: git diff --quiet || { echo "Build Changes"; git diff; git status; false; } @echo -### -### Generate Modules -### -.PHONY: gen-modules -gen-modules: - ./bin/modules-generate.py $(ARGS) - ### ### Generate Dockerfiles ### .PHONY: gen-dockerfiles gen-dockerfiles: + @echo "################################################################################" + @echo "# Generating PHP modules" + @echo "################################################################################" + ./bin/gen-php-modules.py $(MODS) + @echo + @echo "################################################################################" + @echo "# Generating Tools" + @echo "################################################################################" + ./bin/gen-php-tools.py $(TOOLS) + @echo + @echo "################################################################################" + @echo "# Generating Dockerfiles" + @echo "################################################################################" docker run --rm \ $$(tty -s && echo "-it" || echo) \ -e USER=ansible \ @@ -250,11 +259,10 @@ gen-dockerfiles: -e MY_GID=$$(id -g) \ -v ${PWD}:/data \ -w /data/.ansible \ - cytopia/ansible:2.13-tools ansible-playbook generate.yml \ - -e ANSIBLE_STRATEGY_PLUGINS=/usr/lib/python3.10/site-packages/ansible_mitogen/plugins/strategy \ - -e ANSIBLE_STRATEGY=mitogen_linear \ + cytopia/ansible:2.12-tools ansible-playbook generate.yml \ -e ansible_python_interpreter=/usr/bin/python3 \ -e \"{build_fail_fast: $(FAIL_FAST)}\" \ + --forks 50 \ --diff $(ARGS) @@ -286,8 +294,8 @@ check-stage-is-set: echo "Exiting."; \ exit 1; \ fi - @if [ "$(STAGE)" != "base" ] && [ "$(STAGE)" != "mods" ] && [ "$(STAGE)" != "prod" ] && [ "$(STAGE)" != "work" ]; then \ - echo "Error, Flavour can only be one of 'base', 'mods', 'prod', or 'work'."; \ + @if [ "$(STAGE)" != "base" ] && [ "$(STAGE)" != "mods" ] && [ "$(STAGE)" != "prod" ] && [ "$(STAGE)" != "slim" ] && [ "$(STAGE)" != "work" ]; then \ + echo "Error, Flavour can only be one of 'base', 'mods', 'prod', 'slim' or 'work'."; \ echo "Exiting."; \ exit 1; \ fi @@ -325,6 +333,22 @@ check-current-image-exists: check-parent-image-exists: check-stage-is-set check-parent-image-exists: @if [ "$(STAGE)" = "work" ]; then \ + if [ "$$( docker images -q $(IMAGE):$(SLIM_TAG) )" = "" ]; then \ + >&2 echo "Docker image '$(IMAGE):$(SLIM_TAG)' was not found locally."; \ + >&2 echo "Either build it first or explicitly pull it from Dockerhub."; \ + >&2 echo "This is a safeguard to not automatically pull the Docker image."; \ + >&2 echo; \ + exit 1; \ + fi; \ + OS="$$( docker image inspect $(IMAGE):$(SLIM_TAG) --format '{{.Os}}' )"; \ + ARCH="$$( docker image inspect $(IMAGE):$(SLIM_TAG) --format '{{.Architecture}}' )"; \ + if [ "$${OS}/$${ARCH}" != "$(ARCH)" ]; then \ + >&2 echo "Docker image '$(IMAGE):$(SLIM_TAG)' has invalid architecture: $${OS}/$${ARCH}"; \ + >&2 echo "Expected: $(ARCH)"; \ + >&2 echo; \ + exit 1; \ + fi; \ + elif [ "$(STAGE)" = "slim" ]; then \ if [ "$$( docker images -q $(IMAGE):$(PROD_TAG) )" = "" ]; then \ >&2 echo "Docker image '$(IMAGE):$(PROD_TAG)' was not found locally."; \ >&2 echo "Either build it first or explicitly pull it from Dockerhub."; \ diff --git a/README.md b/README.md index 81f6baa..49f775c 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ This repository also allows you to quickly generate and **build your own custom * [`5.2-base`](Dockerfiles/base/Dockerfile-5.2), [`5.3-base`](Dockerfiles/base/Dockerfile-5.3), [`5.4-base`](Dockerfiles/base/Dockerfile-5.4), [`5.5-base`](Dockerfiles/base/Dockerfile-5.5), [`5.6-base`](Dockerfiles/base/Dockerfile-5.6), [`7.0-base`](Dockerfiles/base/Dockerfile-7.0), [`7.1-base`](Dockerfiles/base/Dockerfile-7.1), [`7.2-base`](Dockerfiles/base/Dockerfile-7.2), [`7.3-base`](Dockerfiles/base/Dockerfile-7.3), [`7.4-base`](Dockerfiles/base/Dockerfile-7.4), [`8.0-base`](Dockerfiles/base/Dockerfile-8.0), [`8.1-base`](Dockerfiles/base/Dockerfile-8.1), [`8.2-base`](Dockerfiles/base/Dockerfile-8.2) * [`5.2-mods`](Dockerfiles/mods/Dockerfile-5.2), [`5.3-mods`](Dockerfiles/mods/Dockerfile-5.3), [`5.4-mods`](Dockerfiles/mods/Dockerfile-5.4), [`5.5-mods`](Dockerfiles/mods/Dockerfile-5.5), [`5.6-mods`](Dockerfiles/mods/Dockerfile-5.6), [`7.0-mods`](Dockerfiles/mods/Dockerfile-7.0), [`7.1-mods`](Dockerfiles/mods/Dockerfile-7.1), [`7.2-mods`](Dockerfiles/mods/Dockerfile-7.2), [`7.3-mods`](Dockerfiles/mods/Dockerfile-7.3), [`7.4-mods`](Dockerfiles/mods/Dockerfile-7.4), [`8.0-mods`](Dockerfiles/mods/Dockerfile-8.0), [`8.1-mods`](Dockerfiles/mods/Dockerfile-8.1), [`8.2-mods`](Dockerfiles/mods/Dockerfile-8.2) * [`5.2-prod`](Dockerfiles/prod/Dockerfile-5.2), [`5.3-prod`](Dockerfiles/prod/Dockerfile-5.3), [`5.4-prod`](Dockerfiles/prod/Dockerfile-5.4), [`5.5-prod`](Dockerfiles/prod/Dockerfile-5.5), [`5.6-prod`](Dockerfiles/prod/Dockerfile-5.6), [`7.0-prod`](Dockerfiles/prod/Dockerfile-7.0), [`7.1-prod`](Dockerfiles/prod/Dockerfile-7.1), [`7.2-prod`](Dockerfiles/prod/Dockerfile-7.2), [`7.3-prod`](Dockerfiles/prod/Dockerfile-7.3), [`7.4-prod`](Dockerfiles/prod/Dockerfile-7.4), [`8.0-prod`](Dockerfiles/prod/Dockerfile-8.0), [`8.1-prod`](Dockerfiles/prod/Dockerfile-8.1), [`8.2-prod`](Dockerfiles/prod/Dockerfile-8.2) +* [`5.2-slim`](Dockerfiles/slim/Dockerfile-5.2), [`5.3-slim`](Dockerfiles/slim/Dockerfile-5.3), [`5.4-slim`](Dockerfiles/slim/Dockerfile-5.4), [`5.5-slim`](Dockerfiles/slim/Dockerfile-5.5), [`5.6-slim`](Dockerfiles/slim/Dockerfile-5.6), [`7.0-slim`](Dockerfiles/slim/Dockerfile-7.0), [`7.1-slim`](Dockerfiles/slim/Dockerfile-7.1), [`7.2-slim`](Dockerfiles/slim/Dockerfile-7.2), [`7.3-slim`](Dockerfiles/slim/Dockerfile-7.3), [`7.4-slim`](Dockerfiles/slim/Dockerfile-7.4), [`8.0-slim`](Dockerfiles/slim/Dockerfile-8.0), [`8.1-slim`](Dockerfiles/slim/Dockerfile-8.1), [`8.2-slim`](Dockerfiles/slim/Dockerfile-8.2) * [`5.2-work`](Dockerfiles/work/Dockerfile-5.2), [`5.3-work`](Dockerfiles/work/Dockerfile-5.3), [`5.4-work`](Dockerfiles/work/Dockerfile-5.4), [`5.5-work`](Dockerfiles/work/Dockerfile-5.5), [`5.6-work`](Dockerfiles/work/Dockerfile-5.6), [`7.0-work`](Dockerfiles/work/Dockerfile-7.0), [`7.1-work`](Dockerfiles/work/Dockerfile-7.1), [`7.2-work`](Dockerfiles/work/Dockerfile-7.2), [`7.3-work`](Dockerfiles/work/Dockerfile-7.3), [`7.4-work`](Dockerfiles/work/Dockerfile-7.4), [`8.0-work`](Dockerfiles/work/Dockerfile-8.0), [`8.1-work`](Dockerfiles/work/Dockerfile-8.1), [`8.2-work`](Dockerfiles/work/Dockerfile-8.2) :information_source: For details see **[Documentation: Docker Tags](doc/docker-tags.md)**
@@ -60,8 +61,8 @@ The provided Docker images heavily rely on inheritance to guarantee smallest pos ^ # | # | # - [base] # Introduces env variables and adjusts entrypoint - ^ # + [base] # Streamlined base images with host user mapping + ^ # environment variables and custom configs. | # | # [mods] # Installs additional PHP modules @@ -72,6 +73,10 @@ The provided Docker images heavily rely on inheritance to guarantee smallest pos ^ # (locales, postifx, socat and injectables) | # (custom *.ini files) | # + [slim] # Devilbox flavour with only required + ^ # cli tools to have a functional intranet. + | # + | # [work] # Devilbox flavour for local development # (includes backup and development tools) # (sudo, custom bash and tool configs) @@ -195,7 +200,7 @@ The provided Docker images heavily rely on inheritance to guarantee smallest pos :information_source: For details see **[Documentation: PHP Modules](doc/php-modules.md)**
-:information_source: For details see **[Contributor Documentation: PHP Modules](php_modules/README.md)** +:information_source: For details see **[Contributor Documentation: PHP Module definition](php_modules/README.md)** @@ -218,6 +223,10 @@ The provided Docker images offer environment variables to alter their startup be `DEBUG_ENTRYPOINT`, `NEW_UID`, `NEW_GID`, `TIMEZONE`, `DOCKER_LOGS`, `ENABLE_MODULES`, `DISABLE_MODULES`, `ENABLE_MAIL`, `FORWARD_PORTS_TO_LOCALHOST` +#### Flavour: slim + +`DEBUG_ENTRYPOINT`, `NEW_UID`, `NEW_GID`, `TIMEZONE`, `DOCKER_LOGS`, `ENABLE_MODULES`, `DISABLE_MODULES`, `ENABLE_MAIL`, `FORWARD_PORTS_TO_LOCALHOST`,` MYSQL_BACKUP_USER`, `MYSQL_BACKUP_PASS`, `MYSQL_BACKUP_HOST` + #### Flavour: work `DEBUG_ENTRYPOINT`, `NEW_UID`, `NEW_GID`, `TIMEZONE`, `DOCKER_LOGS`, `ENABLE_MODULES`, `DISABLE_MODULES`, `ENABLE_MAIL`, `FORWARD_PORTS_TO_LOCALHOST`,` MYSQL_BACKUP_USER`, `MYSQL_BACKUP_PASS`, `MYSQL_BACKUP_HOST` @@ -246,6 +255,16 @@ The provided Docker images offer different volumes to be mounted * **[`/var/log/php`]()**, **[`/var/mail`]()** - *logs and mail data* * **[`/etc/supervisor/custom.d`]()** - *custom supervisord config files* +#### Flavour: slim + +* **[`/etc/php-custom.d`]()**, **[`/etc/php-fpm-custom.d`]()** - *custom PHP/PHP-FPM config files* +* **[`/startup.1.d`]()**, **[`/startup.2.d`]()** - *custom startup scripts* +* **[`/var/log/php`]()**, **[`/var/mail`]()** - *logs and mail data* +* **[`/etc/supervisor/custom.d`]()** - *custom supervisord config files* +* **[`/etc/bashrc-devilbox.d`]()** - *custom bashrc config files* +* **[`/shared/backups`]()** - *backup data* +* **[`/ca`]()** - *trusted Certificate Authorities* + #### Flavour: work * **[`/etc/php-custom.d`]()**, **[`/etc/php-fpm-custom.d`]()** - *custom PHP/PHP-FPM config files* @@ -271,7 +290,7 @@ Have a look at the following table to see all offered exposed ports for each Doc - base
mods
prod
work + base
mods
prod
slim
work 9000 PHP-FPM listening port @@ -290,7 +309,8 @@ Each PHP version is using the same sane default php.ini values, making it pain-f | base | [php.ini](Dockerfiles/base/data/php-ini.d/) and [php-fpm.conf](Dockerfiles/base/data/php-fpm.conf/) | | mods | inherits from base | | prod | inherits from base | -| work | [php.ini](Dockerfiles/work/data/php-ini.d/) [php-fpm.conf](Dockerfiles/work/data/php-fpm.conf/) | +| slim | [php.ini](Dockerfiles/work/data/php-ini.d/) and [php-fpm.conf](Dockerfiles/work/data/php-fpm.conf/) | +| work | inherits from slim | @@ -300,7 +320,11 @@ If you plan to use the PHP-FPM image for development, hence being able to execut The **work** Docker image has many common tools already installed which on one hand increases its image size, but on the other hand removes the necessity to install those tools locally. -You want to use tools such as `git`, `drush`, `composer`, `npm`, `eslint`, `phpcs` as well as many others, simply do it directly inside the container. As all Docker images are auto-built every night by GitHub Actions it is assured that you are always at the latest version of your favorite dev tool. +You want to use tools such as `angular-cli`, `codeception`, **`composer`**, `deployer`, `eslint`, `git`, `grunt-cli`, `gulp`, `laravel-installer`, **`node`**, **`npm`**, **`nvm`**, `phalcon-devtools`, `phpcs`, `phpunit`, `pm2`, `symfony-cli`, `tig`, `vue`, `webpack-cli`, `wp-cli`, **`yarn`**, `yq`, `zsh` as well as many others, simply do it directly inside the container. As all Docker images are auto-built every night by GitHub Actions it is assured that you are always at the latest version of your favorite dev tool. + + :information_source: For details see **[Documentation: Available Tools](doc/available-tools.md)** @@ -422,7 +446,7 @@ $ docker exec -it php mysqldump-secure #### Docker Compose reference implementation -If you want a fully functional Docker Compose setup, which allows to switch PHP versions easily, comes with web servers, database servers and much more, then head over to the rerefence implementation: +If you want a fully functional Docker Compose setup, which allows to switch PHP versions easily, comes with web servers, database servers and much more, then head over to the **[Devilbox](https://github.com/cytopia/devilbox)** rerefence implementation : | Reference Implementation | |--------------------------| @@ -440,13 +464,10 @@ Docker images are built and tested every night by **[GitHub Actions](https://git

Build your own image

You are not interested in the provided Docker images and want to (ab)use this repository purely to generate your own custom images? -You can do so with four easy commands: +You can do so with three easy commands: ```bash -# Generate Ansible group_vars for the following PHP extensions -make gen-modules ARGS="msgpack memcached pdo_mysql rdkafka" - -# Generate Dockerfiles -make gen-dockerfiles +# Generate Dockerfiles with only the following PHP extensions present +make gen-dockerfiles MODS="msgpack memcached pdo_mysql rdkafka" # Pull base image for PHP 8.1 (if you don't have it locally already) make docker-pull-base-image STAGE=mods VERSION=8.1 ARCH=linux/arm64 @@ -462,7 +483,7 @@ make build STAGE=mods VERSION=8.1 ARCH=linux/arm64 Contributors are welcome. Feel free to star and clone this repository and submit issues and pull-requests. Add examples and show what you have created with the provided images. If you see any errors or ways to improve this repository in any way, please do so. -:information_source: For details see **[Contributor Documentation: PHP Modules](php_modules/README.md)** +:information_source: For details see **[Contributor Documentation: PHP Module definitions](php_modules/README.md)**

Related Project

diff --git a/bin/Makefile b/bin/Makefile index 68cb445..d27d036 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -23,7 +23,7 @@ MYPY_ARGS = --strict --disable-error-code no-any-return PYLINT_DIR = *.py PYLINT_PIP_PKGS = yamllint -PYLINT_ARGS = --disable=invalid-name +PYLINT_ARGS = --disable=invalid-name,duplicate-code,consider-using-f-string PYCODE_ARGS = --max-line-length=100 diff --git a/bin/gen-readme.sh b/bin/gen-docs-php-modules.sh similarity index 86% rename from bin/gen-readme.sh rename to bin/gen-docs-php-modules.sh index 2e2b4ab..a302ce2 100755 --- a/bin/gen-readme.sh +++ b/bin/gen-docs-php-modules.sh @@ -9,6 +9,10 @@ set -o pipefail SCRIPT_PATH="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" SCRIPT_NAME="$(basename "${SCRIPT_PATH}")" REPO_PATH="${SCRIPT_PATH}/.." + +### +### This file is being updated +### README="${REPO_PATH}/doc/php-modules.md" @@ -105,14 +109,14 @@ get_modules_from_image() { ### -### Validate that README.md has all modules defined that are found in the PHP docker image +### Validate that *.md file has all modules defined that are found in the PHP docker image ### validate_readme() { local php_version="${1}" local modules_img="${2}" # Modules found in the PHP docker image local stage="${3}" # base or mods - # Check if README.md contains all modules we have retrieved from the PHP image + # Check if *.md contains all modules we have retrieved from the PHP image while read -r line; do module="$( echo "${line}" | tr '[:upper:]' '[:lower:]' )" search="ext_${stage}_${module}_${php_version}" @@ -126,7 +130,7 @@ validate_readme() { ### -### Update README.md for a specific PHP version +### Update *.md for a specific PHP version ### update_readme() { local php_version="${1}" @@ -147,7 +151,7 @@ update_readme() { done < <(echo "${modules_image}") if [ "${avail}" = "1" ]; then - sed -i "s|\(\)\(.*\)\(<\/td>\)|\1🗸\3|g" "${README}" + sed -i "s|\(\)\(.*\)\(<\/td>\)|\1✓\3|g" "${README}" echo "[YES] [${stage}] PHP ${php_version}, mod: '${module_avail}'" else sed -i "s|\(\)\(.*\)\(<\/td>\)|\1\3|g" "${README}" @@ -181,19 +185,19 @@ update_readme() { # MOD_LOWER="$( echo "${MOD_NAME}" | tr '[:upper:]' '[:lower:]' )" # echo " " # echo " ${MOD_NAME}" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" -# echo " 🗸" +# echo " ✓" +# echo " ✓" +# echo " ✓" +# echo " ✓" +# echo " ✓" +# echo " ✓" +# echo " ✓" +# echo " ✓" +# echo " ✓" +# echo " ✓" +# echo " ✓" +# echo " ✓" +# echo " ✓" # echo " " #done < <(echo "${MODS_IMAGE}") #echo "" diff --git a/bin/gen-docs-php-tools.py b/bin/gen-docs-php-tools.py new file mode 100755 index 0000000..fd3a368 --- /dev/null +++ b/bin/gen-docs-php-tools.py @@ -0,0 +1,205 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +"""Generate Ansible group_vars from tools (installed software) definition.""" +import os +import re +import sys +from typing import Dict, List, Any +import yaml + + +# -------------------------------------------------------------------------------------------------- +# GLOBALS +# -------------------------------------------------------------------------------------------------- + +SCRIPT_PATH = str(os.path.dirname(os.path.realpath(__file__))) +REPOSITORY_PATH = str(os.path.dirname(SCRIPT_PATH)) +PHP_TOOL_PATH = str(os.path.join(REPOSITORY_PATH, "php_tools")) +DOC_FILE = str(os.path.join(REPOSITORY_PATH, "doc", "available-tools.md")) + + +PHP_VERSIONS = [ + "5.2", + "5.3", + "5.4", + "5.5", + "5.6", + "7.0", + "7.1", + "7.2", + "7.3", + "7.4", + "8.0", + "8.1", + "8.2", +] + +DEFAULT_TOOLS = [ + {"name": "**composer**", "dir": "https://getcomposer.org/", "exclude": []}, + {"name": "**corepack**", "dir": "https://nodejs.org/api/corepack.html", "exclude": []}, + {"name": "**nvm**", "dir": "https://github.com/nvm-sh/nvm", "exclude": []}, + {"name": "**npm**", "dir": "https://nodejs.org/en/knowledge/getting-started/npm/what-is-npm/", "exclude": []}, + {"name": "**node**", "dir": "https://nodejs.org/en/", "exclude": []}, + {"name": "**yarn**", "dir": "https://yarnpkg.com/cli/install", "exclude": []}, + {"name": "**pip**", "dir": "https://pypi.org/", "exclude": []}, +] + + +# -------------------------------------------------------------------------------------------------- +# HELPER FUNCTIONS +# -------------------------------------------------------------------------------------------------- + + +def get_el_by_name(items: List[Dict[str, Any]], name: str) -> Dict[str, Any]: + """Returns an element from a dict list by its 'name' key with given value.""" + for item in items: + if item["name"] == name: + return item + print("error, key name not found by value", name, "in list: ", items) + sys.exit(1) + + +def load_yaml(path: str) -> Dict[str, Any]: + """Load yaml file and return its dict().""" + with open(path, "r", encoding="utf8") as fp: + data = yaml.safe_load(fp) + return data + + +def load_yaml_raw(path: str, indent: int = 0) -> str: + """Load and returns yaml file as str.""" + lines = [] + with open(path, "r", encoding="utf8") as fp: + for line in fp: + # Remove: empty lines and --- + if line in ("---\n", "---\r\n", "\n", "\r\n"): + continue + # Remove: comments + if line.startswith("#"): + continue + lines.append(" " * indent + line) + return "".join(lines) + + +# -------------------------------------------------------------------------------------------------- +# TOOL FUNCTIONS +# -------------------------------------------------------------------------------------------------- + + +def get_tool_options(tool_dirname: str) -> Dict[str, Any]: + """Returns yaml dict options of a PHP tool given by its absolute file path.""" + return load_yaml(os.path.join(PHP_TOOL_PATH, tool_dirname, "options.yml")) + + +def get_tools() -> List[Dict[str, Any]]: + """Returns a list of PHP tools.""" + tools = [] + with os.scandir(PHP_TOOL_PATH) as it: + for item in it: + if not item.name.startswith(".") and item.is_dir(): + data = get_tool_options(item.name) + tools.append( + { + "dir": "../php_tools/" + item.name, + "name": data["name"], + "exclude": [str(x) for x in data["exclude"]], + } + ) + return sorted(DEFAULT_TOOLS + tools, key=lambda tool: tool["name"].replace("*", "")) + + +# -------------------------------------------------------------------------------------------------- +# PRINT FUNCTIONS +# -------------------------------------------------------------------------------------------------- + + +def print_terminal(tools: List[Dict[str, Any]]) -> None: + """Print directory tools.""" + padding = 18 + # First Row + print("| {name: <{padding}}| ".format(name="Tool", padding=padding), end="") + print(" | ".join(PHP_VERSIONS), end="") + print(" |") + # Second Row + print("|{name:-<{padding}}-|".format(name="", padding=padding), end="") + for php in PHP_VERSIONS: + print("-----|", end="") + print() + for tool in tools: + print("| {name: <{padding}}|".format(name=tool["name"], padding=padding), end="") + for php in PHP_VERSIONS: + if str(php) in tool["exclude"]: + print(" |", end="") + else: + print(" ✓ |", end="") + print() + + +def get_markdown(tools: List[Dict[str, Any]]) -> str: + """Get markdown tools table.""" + padding = 43 + + # First Row + markdown = "| {name: <{padding}}| PHP ".format(name="Tool", padding=padding) + markdown += " | PHP ".join(PHP_VERSIONS) + markdown += " |\n" + # Second Row + markdown += "|{name:-<{padding}}-|".format(name="", padding=padding) + for php in PHP_VERSIONS: + markdown += "---------|" + markdown += "\n" + for tool in tools: + markdown += "| {name: <{padding}}|".format( + name="[" + tool["name"] + "][lnk_" + tool["name"] + "]", padding=padding + ) + for php in PHP_VERSIONS: + if str(php) in tool["exclude"]: + markdown += " |" + else: + markdown += " ✓ |" + markdown += "\n" + + markdown += "\n" + for tool in tools: + markdown += "[lnk_" + tool["name"] + "]: " + tool["dir"] + "\n" + + return markdown + + +# -------------------------------------------------------------------------------------------------- +# MAIN FUNCTION +# -------------------------------------------------------------------------------------------------- + + +def main() -> None: + """Main entrypoint.""" + # Get tools in order of dependencies + tools = get_tools() + + print("#", "-" * 78) + print("# Paths") + print("#", "-" * 78) + print("Repository: ", REPOSITORY_PATH) + print("PHP Tools: ", PHP_TOOL_PATH) + print() + + print_terminal(tools) + print() + markdown = get_markdown(tools) + print() + + with open(DOC_FILE, "r", encoding="utf8") as f: + content = f.read() + content_new = re.sub( + r"(\<\!\-\- TOOLS_WORK_START \-\-\>)(.*)(\<\!\-\- TOOLS_WORK_END \-\-\>)", + r"\1\n\n" + markdown + r"\n\3", + content, + flags=re.DOTALL, + ) + + with open(DOC_FILE, "w", encoding="utf8") as f: + f.write(content_new) + + +if __name__ == "__main__": + main() diff --git a/bin/modules-generate.py b/bin/gen-php-modules.py similarity index 97% rename from bin/modules-generate.py rename to bin/gen-php-modules.py index c4c0207..97a5ed1 100755 --- a/bin/modules-generate.py +++ b/bin/gen-php-modules.py @@ -87,7 +87,12 @@ def get_modules(selected_modules: List[str], ignore_dependencies: bool) -> List[ if not item.name.startswith(".") and item.is_dir(): data = get_module_options(item.name) modules.append( - {"dir": item.name, "name": data["name"], "deps": data["depends_build"]} + { + "dir": item.name, + "name": data["name"], + "deps": data["depends_build"], + "exclude": data["exclude"], + } ) # Convert list of deps into dict(dir, name, deps) items = [] @@ -153,6 +158,7 @@ def print_modules(modules: List[Dict[str, Any]]) -> None: for dep in module["deps"]: print(dep["name"], end=", ") print() + print(" excl:", module["exclude"]) def print_dependency_tree(tree: Dict[str, Any], lvl: int = 0) -> None: diff --git a/bin/gen-php-tools.py b/bin/gen-php-tools.py new file mode 100755 index 0000000..537607b --- /dev/null +++ b/bin/gen-php-tools.py @@ -0,0 +1,282 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +"""Generate Ansible group_vars from tools (installed software) definition.""" +import os +import sys +from collections import OrderedDict +from typing import Dict, List, Any +import yaml + + +# -------------------------------------------------------------------------------------------------- +# GLOBALS +# -------------------------------------------------------------------------------------------------- + +SCRIPT_PATH = str(os.path.dirname(os.path.realpath(__file__))) +REPOSITORY_PATH = str(os.path.dirname(SCRIPT_PATH)) +PHP_TOOL_PATH = str(os.path.join(REPOSITORY_PATH, "php_tools")) +GROUP_VARS_PATH = str(os.path.join(REPOSITORY_PATH, ".ansible", "group_vars", "all")) + + +# -------------------------------------------------------------------------------------------------- +# HELPER FUNCTIONS +# -------------------------------------------------------------------------------------------------- + + +def get_el_by_name(items: List[Dict[str, Any]], name: str) -> Dict[str, Any]: + """Returns an element from a dict list by its 'name' key with given value.""" + for item in items: + if item["name"] == name: + return item + print("error, key name not found by value", name, "in list: ", items) + sys.exit(1) + + +def load_yaml(path: str) -> Dict[str, Any]: + """Load yaml file and return its dict().""" + with open(path, "r", encoding="utf8") as fp: + data = yaml.safe_load(fp) + return data + + +def load_yaml_raw(path: str, indent: int = 0) -> str: + """Load and returns yaml file as str.""" + lines = [] + with open(path, "r", encoding="utf8") as fp: + for line in fp: + # Remove: empty lines and --- + if line in ("---\n", "---\r\n", "\n", "\r\n"): + continue + # Remove: comments + if line.startswith("#"): + continue + lines.append(" " * indent + line) + return "".join(lines) + + +# -------------------------------------------------------------------------------------------------- +# TOOL FUNCTIONS +# -------------------------------------------------------------------------------------------------- + + +def get_tool_options(tool_dirname: str) -> Dict[str, Any]: + """Returns yaml dict options of a PHP tool given by its absolute file path.""" + return load_yaml(os.path.join(PHP_TOOL_PATH, tool_dirname, "options.yml")) + + +def get_tool_build(tool_dirname: str) -> Dict[str, Any]: + """Returns yaml dict build configuration of a PHP tool given by its absolute file path.""" + return load_yaml(os.path.join(PHP_TOOL_PATH, tool_dirname, "install.yml")) + + +def get_tools(selected_tools: List[str], ignore_dependencies: bool) -> List[Dict[str, Any]]: + """Returns a list of PHP tool directory names. + + Args: + selected_tools: If not empty, only gather specified tools (and its dependencies). + ignore_dependencies: If true, all dependent tools will be ignored. + """ + tools = [] + with os.scandir(PHP_TOOL_PATH) as it: + for item in it: + if not item.name.startswith(".") and item.is_dir(): + data = get_tool_options(item.name) + tools.append( + { + "dir": item.name, + "name": data["name"], + "deps": data["depends"], + "exclude": data["exclude"], + } + ) + # Convert list of deps into dict(dir, name, deps) + items = [] + for tool in tools: + if tool["deps"] and not ignore_dependencies: + deps = [] + for dep in tool["deps"]: + deps.append(get_el_by_name(tools, dep)) + tool["deps"] = deps + items.append(tool) + else: + tool["deps"] = [] + items.append(tool) + # Check if we only want to read a single tool + if selected_tools: + return [get_el_by_name(items, tool_name) for tool_name in selected_tools] + return sorted(items, key=lambda item: item["dir"]) + + +def get_tool_dependency_tree(tools: List[Dict[str, Any]]) -> OrderedDict[str, Any]: + """Returns dictionary of tool dependency tree.""" + tool_tree = OrderedDict() # type: OrderedDict[str, Any] + + for tool in tools: + tool_name = tool["name"] + tool_deps = tool["deps"] + + tool_tree[tool_name] = {} + + # Do we have tool requirements? + if len(tool_deps) > 0: + tool_tree[tool_name] = get_tool_dependency_tree(tool_deps) + return tool_tree + + +def resolve_tool_dependency_tree(tree: OrderedDict[str, Any]) -> List[str]: + """Returns sorted list of resolved dependencies.""" + resolved = [] + for key, _ in tree.items(): + # Has dependenies + if tree[key]: + childs = resolve_tool_dependency_tree(tree[key]) + for child in childs: + if child not in resolved: + resolved.append(child) + # Add current node, if not already available + if key not in resolved: + resolved.append(key) + return resolved + + +# -------------------------------------------------------------------------------------------------- +# PRINT FUNCTIONS +# -------------------------------------------------------------------------------------------------- + + +def print_tools(tools: List[Dict[str, Any]]) -> None: + """Print directory tools.""" + for tool in tools: + print(tool["dir"] + "/") + print(" name:", tool["name"]) + print(" deps:", end=" ") + for dep in tool["deps"]: + print(dep["name"], end=", ") + print() + print(" excl:", tool["exclude"]) + + +def print_dependency_tree(tree: Dict[str, Any], lvl: int = 0) -> None: + """Print dependency tree of tools.""" + for key, value in tree.items(): + print(" " * lvl, "-", key) + if value: + print_dependency_tree(tree[key], lvl + 2) + + +# -------------------------------------------------------------------------------------------------- +# WRITE ANSIBLE GROUP_VARS FUNCTIONS +# -------------------------------------------------------------------------------------------------- + + +def write_group_vars(tools: List[str]) -> None: + """Write work.yml group_vars for ansible.""" + group_vars = os.path.join(GROUP_VARS_PATH, "work.yml") + + with open(group_vars, "w", encoding="utf8") as fp: + fp.write("---\n\n") + fp.write("# DO NOT ALTER THIS FILE - IT IS AUTOGENERATED.\n\n") + + # Enabled tools + fp.write("# The following specifies the order in which tools are being installed.\n") + fp.write("tools_enabled:\n") + for tool in tools: + fp.write(" - " + tool + "\n") + fp.write("\n\n") + + # Build defines tools + fp.write("# The following specifies how tools are being installed.\n") + fp.write("tools_available:\n") + for tool in tools: + opts = get_tool_options(tool) + fp.write(" " + tool + ":\n") + fp.write(" disabled: [" + ", ".join(str(x) for x in opts["exclude"]) + "]\n") + fp.write(load_yaml_raw(os.path.join(PHP_TOOL_PATH, tool, "install.yml"), 4)) + + +# -------------------------------------------------------------------------------------------------- +# MAIN FUNCTION +# -------------------------------------------------------------------------------------------------- +def print_help() -> None: + """Show help screen.""" + print("Usage:", os.path.basename(__file__), "[options] [PHP-TOOL]...") + print(" ", os.path.basename(__file__), "-h, --help") + print() + print("This script will generate the Ansible group_vars file: .ansible/group_vars/all/work.yml") + print("based on all the tools found in php_tools/ directory.") + print() + print("Positional arguments:") + print(" [PHP-TOOL] Specify None, one or more PHP tools to generate group_vars for.") + print(" When no PHP tool is specified (argument is omitted), group_vars") + print(" for all tools will be genrated.") + print(" When one or more PHP tool are specified, only group_vars for") + print(" these tools will be created.") + print(" only be generated for this single tool (and its dependencies).") + print(" This is useful if you want to test new tools and not build all") + print(" previous tools in the Dockerfile.") + print() + print(" Note: You still need to generate the Dockerfiles via Ansible for") + print(" the changes to take effect, before building the image.") + print("Optional arguments:") + print(" -i Ignore dependent tools.") + print(" By default each tool is checked for dependencies of other") + print(" tools.") + print(" By specifying -i, those dependent tools are not beeing added to") + print(" ansible group_vars. Use at your own risk.") + + +def main(argv: List[str]) -> None: + """Main entrypoint.""" + ignore_dependencies = False + selected_tools = [] + if len(argv): + for arg in argv: + if arg in ("-h", "--help"): + print_help() + sys.exit(0) + for arg in argv: + if arg.startswith("-") and arg != "-i": + print("Invalid argument:", arg) + print("Use -h or --help for help") + sys.exit(1) + if arg == "-i": + ignore_dependencies = True + else: + selected_tools.append(arg) + + # Get tools in order of dependencies + tools = get_tools(selected_tools, ignore_dependencies) + tool_tree = get_tool_dependency_tree(tools) + names = resolve_tool_dependency_tree(tool_tree) + + print("#", "-" * 78) + print("# Paths") + print("#", "-" * 78) + print("Repository: ", REPOSITORY_PATH) + print("PHP Tools: ", PHP_TOOL_PATH) + print("Group Vars: ", GROUP_VARS_PATH) + print() + + print("#", "-" * 78) + print("# Tool directories") + print("#", "-" * 78) + print_tools(tools) + print() + + print("#", "-" * 78) + print("# Build Dependency Tree") + print("#", "-" * 78) + print_dependency_tree(tool_tree) + print() + + print("#", "-" * 78) + print("# Build order") + print("#", "-" * 78) + print("\n".join(names)) + + # Create group_vars file work.yml + write_group_vars(names) + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/bin/modules-validate.py b/bin/modules-validate.py deleted file mode 100755 index 9fbcc43..0000000 --- a/bin/modules-validate.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -"""Validate defined modules.""" -print("Not yet implemented *///*") -print() -print("Run modules-generate.py instead, as it also kind of validates.") diff --git a/doc/abuser/README.md b/doc/abuser/README.md index 6afb250..f775ed7 100644 --- a/doc/abuser/README.md +++ b/doc/abuser/README.md @@ -50,29 +50,21 @@ In case you plan to use your custom image for the **[Devilbox](https://github.co > **Note:** All commands are executed in the root of this repository -1. Generate PHP extensions in Ansible group_vars - ```bash - # Generate Ansible group_vars for all available extensions - make gen-modules - ``` - ```bash - # Generate Ansible group_vars for selected extensions - # Note: that also all dependent extensions will be added - make gen-modules ARGS="msgpack xsl" - ``` - ```bash - # Generate Ansible group_vars for selected extensions - # and ignore dependencies - make gen-modules ARGS="-i msgpack xsl" - ``` - ```bash - # Show help - make gen-modules ARGS="--help" - ``` -2. Generate Dockerfiles from Ansible group_vars +1. Generate Dockerfiles with desired PHP extensions ```bash + # Generate Dockerfiles with all available PHP extensions make gen-dockerfiles ``` + ```bash + # Generate Dockerfiles for selected PHP extensions only + # Note: that also all dependent extensions will be added + make gen-dockerfiles MODS="msgpack xsl" + ``` + ```bash + # Generate Dockerfiles for selected PHP extensions + # and ignore dependencies + make gen-dockerfiles MODS="-i msgpack xsl" + ``` #### Build your custom Dockerfile diff --git a/doc/available-tools.md b/doc/available-tools.md index 3a4771f..ed0f093 100644 --- a/doc/available-tools.md +++ b/doc/available-tools.md @@ -14,8 +14,347 @@ Tools |

Documentation

+:information_source: For details on how to generate modules see **[Abuser Documentation: Build your own image](../doc/abuser/README.md)**
-### Available Tools + +### PHP Tools (`slim`) + +The following PHP cli tools are available on the `slim` flavour: + +> :information_source: Click on any tool name to find out what they are + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ToolPHP 5.2PHP 5.3PHP 5.4PHP 5.5PHP 5.6PHP 7.0PHP 7.1PHP 7.2PHP 7.3PHP 7.4PHP 8.0PHP 8.1PHP 8.2
Blackfire✓✓✓✓✓✓✓✓✓✓✓✓✓
MongoDB client✓[1]✓[1]✓[1]✓[1]✓✓✓✓✓✓✓✓✓
MySQL client✓✓✓✓✓✓✓✓✓✓✓✓✓
PostgreSQL client✓[1]✓[1]✓[1]✓[1]✓[1]✓[1]✓✓✓✓✓✓✓
Redis client✓✓✓✓✓✓✓✓✓✓✓✓✓
SQLite client✓✓✓✓✓✓✓✓✓✓✓✓✓
dig✓✓✓✓✓✓✓✓✓✓✓✓✓
mhsendmail✓✓✓✓✓✓✓✓✓✓✓✓✓
mysqldump-secure✓✓✓✓✓✓✓✓✓✓✓✓✓
netcat✓✓✓✓✓✓✓✓✓✓✓✓✓
ping✓✓✓✓✓✓✓✓✓✓✓✓✓
sudo✓✓✓✓✓✓✓✓✓✓✓✓✓
+ +> :exclamation: **\[1\]** Not available on `arm64` Docker image. + + + +### PHP Tools (`work`) + +Additionally to all of the `slim` tools shown above, the following PHP cli tools are available on the `work` flavour: + +> :information_source: Click on any tool name to find out what they are + + + + +| Tool | PHP 5.2 | PHP 5.3 | PHP 5.4 | PHP 5.5 | PHP 5.6 | PHP 7.0 | PHP 7.1 | PHP 7.2 | PHP 7.3 | PHP 7.4 | PHP 8.0 | PHP 8.1 | PHP 8.2 | +|--------------------------------------------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------| +| [angular-cli][lnk_angular-cli] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [asgardcms][lnk_asgardcms] | | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [awesome-ci][lnk_awesome-ci] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [codeception][lnk_codeception] | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [**composer**][lnk_**composer**] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [**corepack**][lnk_**corepack**] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [deployer][lnk_deployer] | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [eslint][lnk_eslint] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [git][lnk_git] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [git-flow][lnk_git-flow] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [grunt-cli][lnk_grunt-cli] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [gulp][lnk_gulp] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [jq][lnk_jq] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [jsonlint][lnk_jsonlint] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [laravel-installer][lnk_laravel-installer] | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [laravel-lumen][lnk_laravel-lumen] | | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [linkcheck][lnk_linkcheck] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [mdl][lnk_mdl] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [mdlint][lnk_mdlint] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [mupdf-tools][lnk_mupdf-tools] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [**node**][lnk_**node**] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [**npm**][lnk_**npm**] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [**nvm**][lnk_**nvm**] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [phalcon-devtools][lnk_phalcon-devtools] | | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | +| [php-cs-fixer][lnk_php-cs-fixer] | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | +| [phpcbf][lnk_phpcbf] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [phpcs][lnk_phpcs] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [phpmd][lnk_phpmd] | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [phpunit][lnk_phpunit] | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [**pip**][lnk_**pip**] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [pm2][lnk_pm2] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [pwncat][lnk_pwncat] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [rsync][lnk_rsync] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [sass][lnk_sass] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [shellcheck][lnk_shellcheck] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [ssh][lnk_ssh] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [stylelint][lnk_stylelint] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [svn][lnk_svn] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [symfony-cli][lnk_symfony-cli] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [taskfile][lnk_taskfile] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [tig][lnk_tig] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [vim][lnk_vim] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [vue-cli][lnk_vue-cli] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [webpack-cli][lnk_webpack-cli] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [wkhtmltopdf][lnk_wkhtmltopdf] | | | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [wp-cli][lnk_wp-cli] | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [yamllint][lnk_yamllint] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [**yarn**][lnk_**yarn**] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [yq][lnk_yq] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| [zsh][lnk_zsh] | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | + +[lnk_angular-cli]: ../php_tools/angular-cli +[lnk_asgardcms]: ../php_tools/asgardcms +[lnk_awesome-ci]: ../php_tools/awesome-ci +[lnk_codeception]: ../php_tools/codeception +[lnk_**composer**]: https://getcomposer.org/ +[lnk_**corepack**]: https://nodejs.org/api/corepack.html +[lnk_deployer]: ../php_tools/deployer +[lnk_eslint]: ../php_tools/eslint +[lnk_git]: ../php_tools/git +[lnk_git-flow]: ../php_tools/git-flow +[lnk_grunt-cli]: ../php_tools/grunt-cli +[lnk_gulp]: ../php_tools/gulp +[lnk_jq]: ../php_tools/jq +[lnk_jsonlint]: ../php_tools/jsonlint +[lnk_laravel-installer]: ../php_tools/laravel-installer +[lnk_laravel-lumen]: ../php_tools/laravel-lumen +[lnk_linkcheck]: ../php_tools/linkcheck +[lnk_mdl]: ../php_tools/mdl +[lnk_mdlint]: ../php_tools/mdlint +[lnk_mupdf-tools]: ../php_tools/mupdf-tools +[lnk_**node**]: https://nodejs.org/en/ +[lnk_**npm**]: https://nodejs.org/en/knowledge/getting-started/npm/what-is-npm/ +[lnk_**nvm**]: https://github.com/nvm-sh/nvm +[lnk_phalcon-devtools]: ../php_tools/phalcon-devtools +[lnk_php-cs-fixer]: ../php_tools/php-cs-fixer +[lnk_phpcbf]: ../php_tools/phpcbf +[lnk_phpcs]: ../php_tools/phpcs +[lnk_phpmd]: ../php_tools/phpmd +[lnk_phpunit]: ../php_tools/phpunit +[lnk_**pip**]: https://pypi.org/ +[lnk_pm2]: ../php_tools/pm2 +[lnk_pwncat]: ../php_tools/pwncat +[lnk_rsync]: ../php_tools/rsync +[lnk_sass]: ../php_tools/sass +[lnk_shellcheck]: ../php_tools/shellcheck +[lnk_ssh]: ../php_tools/ssh +[lnk_stylelint]: ../php_tools/stylelint +[lnk_svn]: ../php_tools/svn +[lnk_symfony-cli]: ../php_tools/symfony-cli +[lnk_taskfile]: ../php_tools/taskfile +[lnk_tig]: ../php_tools/tig +[lnk_vim]: ../php_tools/vim +[lnk_vue-cli]: ../php_tools/vue-cli +[lnk_webpack-cli]: ../php_tools/webpack-cli +[lnk_wkhtmltopdf]: ../php_tools/wkhtmltopdf +[lnk_wp-cli]: ../php_tools/wp-cli +[lnk_yamllint]: ../php_tools/yamllint +[lnk_**yarn**]: https://yarnpkg.com/cli/install +[lnk_yq]: ../php_tools/yq +[lnk_zsh]: ../php_tools/zsh + + + + +### PHP Tools (`work`) - deprecated > **Disclaimer:** It is currently not clear what tools are available in which PHP image (version-dependent). This documentation was done by hand and work has currently started to automate this and keep exact tools up-to-date for each of the provided PHP version. diff --git a/doc/php-modules.md b/doc/php-modules.md index 5145d07..95e1378 100644 --- a/doc/php-modules.md +++ b/doc/php-modules.md @@ -18,7 +18,7 @@ Extensions | :information_source: For details on how to add/edit modules see **[Contributor Documentation: PHP Modules](../php_modules/README.md)** -#### PHP Modules (`base`) +### PHP Modules (`base`) The following PHP modules are available on the `base` flavour: @@ -43,75 +43,75 @@ The following PHP modules are available on the `base` flavour: ctype - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ curl - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ date - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ dom - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ ereg - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ @@ -133,145 +133,145 @@ The following PHP modules are available on the `base` flavour: - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ fileinfo - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ filter - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ ftp - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ hash - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ iconv - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ json - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ libxml - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ mbstring - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ mhash - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ @@ -284,114 +284,114 @@ The following PHP modules are available on the `base` flavour: mysqlnd - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ openssl - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ pcre - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ PDO - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ pdo_sqlite - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ Phar - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ posix - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ random @@ -407,30 +407,30 @@ The following PHP modules are available on the `base` flavour: - 🗸 + ✓ readline - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ recode - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ @@ -443,51 +443,51 @@ The following PHP modules are available on the `base` flavour: Reflection - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ session - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ SimpleXML - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ sodium @@ -498,33 +498,33 @@ The following PHP modules are available on the `base` flavour: - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ SPL - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ sqlite - 🗸 - 🗸 + ✓ + ✓ @@ -540,104 +540,104 @@ The following PHP modules are available on the `base` flavour: sqlite3 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ tokenizer - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ xml - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ xmlreader - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ xmlwriter - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ zlib - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 - 🗸 + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ + ✓ -#### PHP Modules (`mods`, `prod` and `work`) +### PHP Modules (`mods`, `prod` and `work`) The following PHP modules are available on the `mods`, `prod` and `work` flavour: @@ -662,27 +662,27 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - + + + + @@ -695,34 +695,34 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -730,151 +730,151 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - + + + - - - - + + + + @@ -886,19 +886,19 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -911,198 +911,198 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + @@ -1110,83 +1110,83 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -1195,14 +1195,14 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - + + + + + + + + @@ -1211,86 +1211,86 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + @@ -1302,11 +1302,11 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - + + + + + @@ -1319,42 +1319,42 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + @@ -1366,195 +1366,195 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -1563,46 +1563,46 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -1611,110 +1611,110 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + @@ -1730,51 +1730,51 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + @@ -1782,131 +1782,131 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -1917,12 +1917,12 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - + + + + + + @@ -1932,34 +1932,34 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + @@ -1975,18 +1975,18 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - - - - - + + + + + + + + + + + + @@ -1995,14 +1995,14 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - + + + + + + + + @@ -2011,11 +2011,11 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - + + + + + @@ -2023,142 +2023,142 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + @@ -2171,30 +2171,30 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -2203,142 +2203,142 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -2347,13 +2347,13 @@ The following PHP modules are available on the `mods`, `prod` and `work` flavour - - - - - - - - + + + + + + + +
amqp🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
apc 🗸🗸🗸🗸✓✓✓✓
apcu 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓
bcmath🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
blackfire 🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓
bz2🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
calendar🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
ctype🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
curl🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
date🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
dba🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
dom🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
enchant🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓ 🗸🗸🗸✓✓✓
ereg 🗸🗸🗸🗸✓✓✓✓
exif🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
FFI 🗸🗸🗸🗸✓✓✓✓
fileinfo🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
filter🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
ftp🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
gd🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
gettext🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
gmp 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓
hash🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
iconv🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
igbinary🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
imagick 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓
imap🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
interbase🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓
intl🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
ioncube 🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓
json🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
ldap🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
libxml🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
lz4 🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓
lzf 🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓
mbstring🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
mcrypt🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓
memcache🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
memcached🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
mhash🗸🗸🗸🗸🗸✓✓✓✓✓
mongo🗸🗸🗸🗸🗸✓✓✓✓✓
mongodb 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓
msgpack🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
mysql🗸🗸🗸🗸🗸✓✓✓✓✓
mysqli🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
mysqlnd 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓
OAuth🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
oci8 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓
OPcache🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
openssl🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
pcntl🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
pcre🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
PDO🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
pdo_dblib🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
PDO_Firebird🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
pdo_mysql🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
PDO_OCI 🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓
pdo_pgsql🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
pdo_sqlite🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
pdo_sqlsrv 🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓
pgsql🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
phalcon 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓
Phar🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
posix🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
pspell🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
psr 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓
random 🗸✓
rdkafka 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓
readline🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
recode🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓
redis🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
Reflection🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
session🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
shmop🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
SimpleXML🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
snmp🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
soap🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
sockets🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
sodium 🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓
solr 🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓
SPL🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
sqlite🗸🗸✓✓
sqlite3 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓
sqlsrv 🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓
ssh2 🗸🗸🗸🗸🗸✓✓✓✓✓
swoole 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓
sysvmsg🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
sysvsem🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
sysvshm🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
tidy🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
tokenizer🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
uploadprogress🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
uuid 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓
wddx🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓ 🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓
Xdebug🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
xlswriter 🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓
xml🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
xmlreader🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
xmlrpc🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓
xmlwriter🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
xsl🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
yaml 🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓
zip🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
zlib🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓✓✓✓✓✓
zstd 🗸🗸🗸🗸🗸🗸🗸🗸✓✓✓✓✓✓✓✓
diff --git a/php_modules/README.md b/php_modules/README.md index b2ad686..b7d8475 100644 --- a/php_modules/README.md +++ b/php_modules/README.md @@ -26,19 +26,17 @@ All PHP modules/extensions (for all PHP versions and both for `amd64` and `arm64 3. Alter `build.yml`, `options.yml` and `test.yml` according to documentation below 2. **Inside the root of this git repository:** - 1. Run `make gen-modules` to create Ansible group_vars - 2. Run `make gen-dockerfiles` to generate Dockerfiles via Ansible - 3. Run `make build STAGE=mods VERSION=8.1 ARCH=linux/amd64` to build the `mods` Docker image with version `8.1` for platform `linux/amd64` + 1. Run `make gen-dockerfiles` to generate Dockerfiles via Ansible + 2. Run `make build STAGE=mods VERSION=8.1 ARCH=linux/amd64` to build the `mods` Docker image with version `8.1` for platform `linux/amd64` **Note:** If you want to test if your new module builds correctly, you can generate Dockerfiles which only contain this one module and all others removed. This allows for much faster Docker builds and you don't have to wait for all other modules to be built. To do so, generate only group_vars for your one module via: ```bash # Commands shown here are executed from root of this repository -# Only generate group_vars for curl +# Only generate Dockerfiles with PHP extension curl # Note: if curl has other modules as requirements to be built beforehand, those will also be added -make gen-modules ARGS="curl" -make gen-dockerfiles +make gen-dockerfiles MODS="curl" ``` :information_source: For details on how to generate modules see **[Abuser Documentation: Build your own image](../doc/abuser/README.md)** diff --git a/php_modules/xdebug/build.yml b/php_modules/xdebug/build.yml index 977be01..2f22818 100644 --- a/php_modules/xdebug/build.yml +++ b/php_modules/xdebug/build.yml @@ -8,18 +8,17 @@ all: type: pecl -8.2: - type: git - git_url: https://github.com/xdebug/xdebug - # FIXME: revert to latest tag once PHP 8.2 support is out of alpha/beta - git_ref: 3.2.0RC2 - configure: --enable-xdebug +7.4: + type: pecl + version: 3.1.6 -8.1: - type: git - git_url: https://github.com/xdebug/xdebug - git_ref: $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1) - configure: --enable-xdebug +7.3: + type: pecl + version: 3.1.6 + +7.2: + type: pecl + version: 3.1.6 7.1: type: pecl diff --git a/php_tools/angular-cli/README.md b/php_tools/angular-cli/README.md new file mode 100644 index 0000000..cdef121 --- /dev/null +++ b/php_tools/angular-cli/README.md @@ -0,0 +1,8 @@ +# Angular CLI + +The CLI tool for Angular. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/@angular/cli | +| GitHub | https://github.com/angular/angular-cli | diff --git a/php_tools/angular-cli/install.yml b/php_tools/angular-cli/install.yml new file mode 100644 index 0000000..6bcedcc --- /dev/null +++ b/php_tools/angular-cli/install.yml @@ -0,0 +1,13 @@ +--- + +check: ng version 2>&1 | grep -iE 'Angular CLI:\s*[0-9][.0-9]+' || (ng version; false) + +all: + type: npm + package: "@angular/cli" + binary: ng + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/angular-cli/options.yml b/php_tools/angular-cli/options.yml new file mode 100644 index 0000000..59269bf --- /dev/null +++ b/php_tools/angular-cli/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: angular-cli + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/asgardcms/README.md b/php_tools/asgardcms/README.md new file mode 100644 index 0000000..c9e98f5 --- /dev/null +++ b/php_tools/asgardcms/README.md @@ -0,0 +1,8 @@ +# AsgardCms + +AsgardCms application installer. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Composer | https://packagist.org/packages/asgardcms/asgardcms-installer | +| GitHub | https://github.com/AsgardCms/asgardcms-installer | diff --git a/php_tools/asgardcms/install.yml b/php_tools/asgardcms/install.yml new file mode 100644 index 0000000..ca833bb --- /dev/null +++ b/php_tools/asgardcms/install.yml @@ -0,0 +1,16 @@ +--- + +check: asgardcms --version 2>/dev/null | grep -Ei 'AsgardCMS\sInstaller\s[0-9][.0-9]+' || (asgardcms --version; false) + +all: + type: composer + composer: 2 + package: asgardcms/asgardcms-installer + # https://github.com/AsgardCms/asgardcms-installer/issues/1 + version: dev-master + flags: + binary: asgardcms + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/asgardcms/options.yml b/php_tools/asgardcms/options.yml new file mode 100644 index 0000000..153882f --- /dev/null +++ b/php_tools/asgardcms/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: asgardcms + +# Exclude module build/installation for the following PHP versions +exclude: [5.2, 5.3, 5.4] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/awesome-ci/README.md b/php_tools/awesome-ci/README.md new file mode 100644 index 0000000..45535ba --- /dev/null +++ b/php_tools/awesome-ci/README.md @@ -0,0 +1,9 @@ +# awesome-ci + +Continuous Integration command line tools for git repositories, file characteristics, syntax errors and static source code analysis. + +Awesome-CI is capable of finding various problems in your code repository as well as fixing them automatically. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/cytopia/awesome-ci/ | diff --git a/php_tools/awesome-ci/install.yml b/php_tools/awesome-ci/install.yml new file mode 100644 index 0000000..835347c --- /dev/null +++ b/php_tools/awesome-ci/install.yml @@ -0,0 +1,16 @@ +--- + +check: regex-grep --version | grep -E '[0-9][.0-9]+' || (regex-grep --version; false) + +all: + type: custom + command: | + git clone https://github.com/cytopia/awesome-ci.git /tmp/awesome-ci \ + && cd /tmp/awesome-ci \ + && git checkout $(git describe --abbrev=0 --tags) \ + && ./configure --prefix=/usr/local \ + && make install \ + && cd / \ + && rm -rf /tmp/awesome-ci \ + # moreutils: isutf8 + run_dep: [dos2unix, file, moreutils] diff --git a/php_tools/awesome-ci/options.yml b/php_tools/awesome-ci/options.yml new file mode 100644 index 0000000..064e93d --- /dev/null +++ b/php_tools/awesome-ci/options.yml @@ -0,0 +1,15 @@ +--- + +# The name of the module +name: awesome-ci + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: + - eslint + - git + - jsonlint + - mdl diff --git a/php_tools/codeception/README.md b/php_tools/codeception/README.md new file mode 100644 index 0000000..b8faa70 --- /dev/null +++ b/php_tools/codeception/README.md @@ -0,0 +1,8 @@ +# Codeception + +BDD-style testing framework. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Composer | https://packagist.org/packages/codeception/codeception | +| GitHub | https://github.com/Codeception/Codeception | diff --git a/php_tools/codeception/install.yml b/php_tools/codeception/install.yml new file mode 100644 index 0000000..ad34347 --- /dev/null +++ b/php_tools/codeception/install.yml @@ -0,0 +1,15 @@ +--- + +check: codecept --version 2>/dev/null | grep -E '^Codeception(\sversion)?\s[0-9][.0-9]+$' || (codecept --version; false) + +all: + type: composer + composer: 2 + package: codeception/codeception + # version: + flags: + binary: codecept + build_dep: [] + run_dep: [] + # pre: + # post: diff --git a/php_tools/codeception/options.yml b/php_tools/codeception/options.yml new file mode 100644 index 0000000..f90af76 --- /dev/null +++ b/php_tools/codeception/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: codeception + +# Exclude module build/installation for the following PHP versions +exclude: [5.2, 5.3] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/deployer/README.md b/php_tools/deployer/README.md new file mode 100644 index 0000000..aa18838 --- /dev/null +++ b/php_tools/deployer/README.md @@ -0,0 +1,8 @@ +# Deployer + +The PHP deployment tool with support for popular frameworks out of the box. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/deployphp/deployer | +| Website | https://deployer.org/ | diff --git a/php_tools/deployer/install.yml b/php_tools/deployer/install.yml new file mode 100644 index 0000000..7832261 --- /dev/null +++ b/php_tools/deployer/install.yml @@ -0,0 +1,28 @@ +--- + +check: dep --version 2>/dev/null | grep -Ei 'deployer\s*(version\s*)?[0-9][.0-9]+' || (dep --version; false) + +all: + type: custom + command: curl -sS -k -L --fail https://deployer.org/deployer.phar -L -o /usr/local/bin/dep + post: chmod +x /usr/local/bin/dep + +7.1: + type: custom + command: curl -sS -k -L --fail https://deployer.org/releases/v6.7.0/deployer.phar -L -o /usr/local/bin/dep + +7.0: + type: custom + command: curl -sS -k -L --fail https://deployer.org/releases/v6.7.0/deployer.phar -L -o /usr/local/bin/dep + +5.6: + type: custom + command: curl -sS -k -L --fail https://deployer.org/releases/v4.3.4/deployer.phar -L -o /usr/local/bin/dep + +5.5: + type: custom + command: curl -sS -k -L --fail https://deployer.org/releases/v4.3.4/deployer.phar -L -o /usr/local/bin/dep + +5.4: + type: custom + command: curl -sS -k -L --fail https://deployer.org/releases/v3.3.0/deployer.phar -L -o /usr/local/bin/dep diff --git a/php_tools/deployer/options.yml b/php_tools/deployer/options.yml new file mode 100644 index 0000000..350c458 --- /dev/null +++ b/php_tools/deployer/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: deployer + +# Exclude module build/installation for the following PHP versions +exclude: [5.2, 5.3] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/eslint/README.md b/php_tools/eslint/README.md new file mode 100644 index 0000000..852e6d6 --- /dev/null +++ b/php_tools/eslint/README.md @@ -0,0 +1,8 @@ +# ESlint + +ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/eslint | +| GitHub | https://github.com/eslint/eslint | diff --git a/php_tools/eslint/install.yml b/php_tools/eslint/install.yml new file mode 100644 index 0000000..ecbdfe9 --- /dev/null +++ b/php_tools/eslint/install.yml @@ -0,0 +1,13 @@ +--- + +check: eslint -v | grep -E '[0-9][.0-9]+' || (eslint -v; false) + +all: + type: npm + package: "eslint" + binary: eslint + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/eslint/options.yml b/php_tools/eslint/options.yml new file mode 100644 index 0000000..947a6c2 --- /dev/null +++ b/php_tools/eslint/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: eslint + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/git-flow/README.md b/php_tools/git-flow/README.md new file mode 100644 index 0000000..c52f623 --- /dev/null +++ b/php_tools/git-flow/README.md @@ -0,0 +1,7 @@ +# git-flow + +A collection of Git extensions to provide high-level repository operations for Vincent Driessen's branching model. This fork adds functionality not added to the original branch. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/petervanderdoes/gitflow-avh | diff --git a/php_tools/git-flow/install.yml b/php_tools/git-flow/install.yml new file mode 100644 index 0000000..de7e71b --- /dev/null +++ b/php_tools/git-flow/install.yml @@ -0,0 +1,11 @@ +--- + +check: git-flow version 2>&1 | grep -E '[0-9][.0-9]+' || (git-flow version; false) + +all: + type: custom + command: | + git clone https://github.com/petervanderdoes/gitflow-avh /tmp/gitflow \ + && cd /tmp/gitflow \ + && make install \ + && cd / && rm -rf /tmp/gitflow \ diff --git a/php_tools/git-flow/options.yml b/php_tools/git-flow/options.yml new file mode 100644 index 0000000..23a9241 --- /dev/null +++ b/php_tools/git-flow/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: git-flow + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [git] diff --git a/php_tools/git/README.md b/php_tools/git/README.md new file mode 100644 index 0000000..4550f5e --- /dev/null +++ b/php_tools/git/README.md @@ -0,0 +1,7 @@ +# Git + +Git - fast, scalable, distributed revision control system. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/git/git | diff --git a/php_tools/git/install.yml b/php_tools/git/install.yml new file mode 100644 index 0000000..8dba045 --- /dev/null +++ b/php_tools/git/install.yml @@ -0,0 +1,7 @@ +--- + +check: git --version 2>&1 | grep -E '[0-9][.0-9]+' || (git --version; false) + +all: + type: apt + package: git diff --git a/php_tools/git/options.yml b/php_tools/git/options.yml new file mode 100644 index 0000000..299f498 --- /dev/null +++ b/php_tools/git/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: git + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/grunt-cli/README.md b/php_tools/grunt-cli/README.md new file mode 100644 index 0000000..c3c9f17 --- /dev/null +++ b/php_tools/grunt-cli/README.md @@ -0,0 +1,8 @@ +# grunt-cli + +The Grunt command line interface. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/grunt-cli | +| GitHub | https://github.com/gruntjs/grunt-cli | diff --git a/php_tools/grunt-cli/install.yml b/php_tools/grunt-cli/install.yml new file mode 100644 index 0000000..8cb337d --- /dev/null +++ b/php_tools/grunt-cli/install.yml @@ -0,0 +1,13 @@ +--- + +check: grunt --version | grep -E '[0-9][.0-9]+' || (grunt --version; false) + +all: + type: npm + package: "grunt-cli" + binary: grunt + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/grunt-cli/options.yml b/php_tools/grunt-cli/options.yml new file mode 100644 index 0000000..db55b97 --- /dev/null +++ b/php_tools/grunt-cli/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: grunt-cli + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/gulp/README.md b/php_tools/gulp/README.md new file mode 100644 index 0000000..68dd24c --- /dev/null +++ b/php_tools/gulp/README.md @@ -0,0 +1,8 @@ +# gulp + +gulp is a toolkit that helps you automate painful or time-consuming tasks in your development workflow. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/gulp | +| GitHub | https://github.com/gulpjs/gulp | diff --git a/php_tools/gulp/install.yml b/php_tools/gulp/install.yml new file mode 100644 index 0000000..a2d0039 --- /dev/null +++ b/php_tools/gulp/install.yml @@ -0,0 +1,13 @@ +--- + +check: gulp --version | grep -E '[0-9][.0-9]+' || (gulp --version; false) + +all: + type: npm + package: gulp + binary: gulp + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/gulp/options.yml b/php_tools/gulp/options.yml new file mode 100644 index 0000000..2ffc2a8 --- /dev/null +++ b/php_tools/gulp/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: gulp + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/jq/README.md b/php_tools/jq/README.md new file mode 100644 index 0000000..3fe58c5 --- /dev/null +++ b/php_tools/jq/README.md @@ -0,0 +1,7 @@ +# yq + +jq is a lightweight and flexible command-line JSON processor. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/stedolan/jq | diff --git a/php_tools/jq/install.yml b/php_tools/jq/install.yml new file mode 100644 index 0000000..afc4a04 --- /dev/null +++ b/php_tools/jq/install.yml @@ -0,0 +1,7 @@ +--- + +check: jq --version 2>&1 | grep -E '[0-9][.0-9]+' || (jq --version; false) + +all: + type: apt + package: jq diff --git a/php_tools/jq/options.yml b/php_tools/jq/options.yml new file mode 100644 index 0000000..586fc32 --- /dev/null +++ b/php_tools/jq/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: jq + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/jsonlint/README.md b/php_tools/jsonlint/README.md new file mode 100644 index 0000000..7845995 --- /dev/null +++ b/php_tools/jsonlint/README.md @@ -0,0 +1,8 @@ +# JSONLint + +A pure JavaScript version of the service provided at jsonlint.com. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/jsonlint | +| GitHub | https://github.com/zaach/jsonlint | diff --git a/php_tools/jsonlint/install.yml b/php_tools/jsonlint/install.yml new file mode 100644 index 0000000..2b86a08 --- /dev/null +++ b/php_tools/jsonlint/install.yml @@ -0,0 +1,13 @@ +--- + +check: jsonlint --version | grep -E '[0-9][.0-9]+' || (jsonlint --version; false) + +all: + type: npm + package: jsonlint + binary: jsonlint + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/jsonlint/options.yml b/php_tools/jsonlint/options.yml new file mode 100644 index 0000000..ff77b65 --- /dev/null +++ b/php_tools/jsonlint/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: jsonlint + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/laravel-installer/README.md b/php_tools/laravel-installer/README.md new file mode 100644 index 0000000..f6c0505 --- /dev/null +++ b/php_tools/laravel-installer/README.md @@ -0,0 +1,8 @@ +# Laravel Installer + +Laravel application installer. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Composer | https://packagist.org/packages/laravel/installer | +| GitHub | https://github.com/laravel/installer | diff --git a/php_tools/laravel-installer/install.yml b/php_tools/laravel-installer/install.yml new file mode 100644 index 0000000..820c61b --- /dev/null +++ b/php_tools/laravel-installer/install.yml @@ -0,0 +1,42 @@ +--- + +check: laravel --version | grep ^Laravel | grep -E '[0-9]\.[0-9]+' || (laravel --version; false) + +all: + type: composer + composer: 2 + package: laravel/installer + # version: + flags: + binary: bin/laravel + build_dep: [] + run_dep: [] + +7.2: + type: composer + version: 4.0.0 + +7.1: + type: composer + binary: laravel + version: 2.3.0 + +7.0: + type: composer + binary: laravel + version: 2.2.0 + +5.6: + type: composer + binary: laravel + version: 2.2.0 + +5.5: + type: composer + binary: laravel + version: 2.2.0 + +5.4: + type: composer + binary: laravel + version: 1.3.7 diff --git a/php_tools/laravel-installer/options.yml b/php_tools/laravel-installer/options.yml new file mode 100644 index 0000000..8deb669 --- /dev/null +++ b/php_tools/laravel-installer/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: laravel-installer + +# Exclude module build/installation for the following PHP versions +exclude: [5.2, 5.3] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/laravel-lumen/README.md b/php_tools/laravel-lumen/README.md new file mode 100644 index 0000000..25ca25a --- /dev/null +++ b/php_tools/laravel-lumen/README.md @@ -0,0 +1,10 @@ +# Laravel Lumen installer + +Lumen application installer. + +**Note:** This package is abandoned and no longer maintained. No replacement package was suggested. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Composer | https://packagist.org/packages/laravel/lumen-installer | +| GitHub | https://github.com/laravel/lumen-installer | diff --git a/php_tools/laravel-lumen/install.yml b/php_tools/laravel-lumen/install.yml new file mode 100644 index 0000000..82ffde4 --- /dev/null +++ b/php_tools/laravel-lumen/install.yml @@ -0,0 +1,15 @@ +--- + +check: lumen --version 2>/dev/null | grep ^Lumen | grep -E '[0-9]\.[0-9]+' || (lumen --version; false) + +all: + type: composer + composer: 2 + package: laravel/lumen-installer + # version: + flags: + binary: lumen + build_dep: [] + run_dep: [] + # pre: + # post: diff --git a/php_tools/laravel-lumen/options.yml b/php_tools/laravel-lumen/options.yml new file mode 100644 index 0000000..7246089 --- /dev/null +++ b/php_tools/laravel-lumen/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: laravel-lumen + +# Exclude module build/installation for the following PHP versions +exclude: [5.2, 5.3, 5.4] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/linkcheck/README.md b/php_tools/linkcheck/README.md new file mode 100644 index 0000000..3556253 --- /dev/null +++ b/php_tools/linkcheck/README.md @@ -0,0 +1,7 @@ +# linkcheck + +linkcheck was created in order to ensure that none of your files have broken links. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/cytopia/linkcheck | diff --git a/php_tools/linkcheck/install.yml b/php_tools/linkcheck/install.yml new file mode 100644 index 0000000..306341e --- /dev/null +++ b/php_tools/linkcheck/install.yml @@ -0,0 +1,10 @@ +--- + +check: linkcheck --version | grep -E 'v[0-9][.0-9]+' || (linkcheck --version; false) + +all: + type: custom + command: curl -sS -L --fail -o /usr/local/bin/linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck + post: chmod +x /usr/local/bin/linkcheck + build_dep: [] + run_dep: [] diff --git a/php_tools/linkcheck/options.yml b/php_tools/linkcheck/options.yml new file mode 100644 index 0000000..7cae845 --- /dev/null +++ b/php_tools/linkcheck/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: linkcheck + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/mdl/README.md b/php_tools/mdl/README.md new file mode 100644 index 0000000..dae01d8 --- /dev/null +++ b/php_tools/mdl/README.md @@ -0,0 +1,9 @@ +# mdl + +A tool to check markdown files and flag style issues. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Gems | https://rubygems.org/gems/mdl | +| Ruby | https://www.ruby-toolbox.com/projects/mdl | +| GitHub | https://github.com/markdownlint/markdownlint | diff --git a/php_tools/mdl/install.yml b/php_tools/mdl/install.yml new file mode 100644 index 0000000..c9411c4 --- /dev/null +++ b/php_tools/mdl/install.yml @@ -0,0 +1,60 @@ +--- + +check: mdl --version | grep -E '[.0-9]+' || (mdl --version; false) + +all: + type: rubygem + package: mdl + # version: + build_dep: [ruby-dev] + run_dep: [ruby] + # pre: + # post: + +7.2: + type: rubygem + version: 0.11.0 + pre: | + gem install chef-utils -v 16.6.14 \ + +7.1: + type: rubygem + version: 0.11.0 + pre: | + gem install chef-utils -v 16.6.14 \ + +7.0: + type: rubygem + version: 0.5.0 + pre: | + gem install mixlib-config -v 2.2.4 \ + +5.6: + type: rubygem + version: 0.5.0 + pre: | + gem install mixlib-config -v 2.2.4 \ + +5.5: + type: rubygem + version: 0.5.0 + pre: | + gem install mixlib-config -v 2.2.4 \ + +5.4: + type: rubygem + version: 0.5.0 + pre: | + gem install mixlib-config -v 2.2.4 \ + +5.3: + type: rubygem + version: 0.5.0 + pre: | + gem install mixlib-config -v 2.2.4 \ + +5.2: + type: rubygem + version: 0.5.0 + pre: | + gem install mixlib-config -v 2.2.4 \ diff --git a/php_tools/mdl/options.yml b/php_tools/mdl/options.yml new file mode 100644 index 0000000..8186673 --- /dev/null +++ b/php_tools/mdl/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: mdl + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/mdlint/README.md b/php_tools/mdlint/README.md new file mode 100644 index 0000000..9962313 --- /dev/null +++ b/php_tools/mdlint/README.md @@ -0,0 +1,8 @@ +# mdlint + +Lint JavaScript code blocks in markdown files to find syntax errors. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/mdlint | +| GitHub | https://github.com/ChrisWren/mdlint | diff --git a/php_tools/mdlint/install.yml b/php_tools/mdlint/install.yml new file mode 100644 index 0000000..e644d43 --- /dev/null +++ b/php_tools/mdlint/install.yml @@ -0,0 +1,13 @@ +--- + +check: mdlint --version | grep -E '[0-9][.0-9]+' || (mdlint --version; false) + +all: + type: npm + package: mdlint + binary: mdlint + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/mdlint/options.yml b/php_tools/mdlint/options.yml new file mode 100644 index 0000000..522ea64 --- /dev/null +++ b/php_tools/mdlint/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: mdlint + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/mupdf-tools/README.md b/php_tools/mupdf-tools/README.md new file mode 100644 index 0000000..f6fb743 --- /dev/null +++ b/php_tools/mupdf-tools/README.md @@ -0,0 +1,9 @@ +# mupdf-tools + +The command line tools allow you to annotate, edit, and convert documents to other formats such as HTML, SVG, PDF, and CBZ. You can also write scripts to manipulate documents using Javascript. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Website | https://mupdf.com/index.html | +| Docs | https://mupdf.com/docs/index.html | +| Git | http://git.ghostscript.com/?p=mupdf.git;a=summary | diff --git a/php_tools/mupdf-tools/install.yml b/php_tools/mupdf-tools/install.yml new file mode 100644 index 0000000..b1368b1 --- /dev/null +++ b/php_tools/mupdf-tools/install.yml @@ -0,0 +1,17 @@ +--- + +check: | + PHP_VERSION="$(php -v | grep ^PHP | awk '{print $2}' | grep -Eo '[0-9]\.[0-9]')" \ + && if echo "${PHP_VERSION}" | grep -E '5\.2|5\.3|5\.4|5\.5'; then \ + mutool 2>&1 | grep ^usage; \ + else \ + echo test > test.txt \ + && mutool create -o test.pdf test.txt \ + && file test.pdf | grep 'PDF document' \ + && rm test.txt \ + && rm test.pdf; \ + fi \ + +all: + type: apt + package: mupdf-tools diff --git a/php_tools/mupdf-tools/options.yml b/php_tools/mupdf-tools/options.yml new file mode 100644 index 0000000..ffb1eb6 --- /dev/null +++ b/php_tools/mupdf-tools/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: mupdf-tools + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/phalcon-devtools/README.md b/php_tools/phalcon-devtools/README.md new file mode 100644 index 0000000..f192bca --- /dev/null +++ b/php_tools/phalcon-devtools/README.md @@ -0,0 +1,11 @@ +# Phalcon Devtools + +This tools provide you useful scripts to generate code helping to develop faster and easy applications that use with Phalcon framework. + +**Note:** In order to use this, you need to explicitly enable `phalcon.so` and `psr.so` in php.ini for PHP CLI and PHP-FPM. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Composer | https://packagist.org/packages/phalcon/devtools | +| GitHub | https://github.com/phalcon/phalcon-devtools | +| Docs | https://docs.phalcon.io/5.0/en/devtools | diff --git a/php_tools/phalcon-devtools/install.yml b/php_tools/phalcon-devtools/install.yml new file mode 100644 index 0000000..a3b6ff1 --- /dev/null +++ b/php_tools/phalcon-devtools/install.yml @@ -0,0 +1,68 @@ +--- + +# Ensure to load phalcon (and its requirement psr prior testing) +check: | + if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + \ + \ + && phalcon commands | grep -E '[0-9][.0-9]+' || (phalcon commands; false) \ + \ + \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + +all: + type: composer + composer: 2 + package: phalcon/devtools + binary: phalcon + # Enable phalcon.so (and its requirement psr prior installing) + pre: | + if find /usr/local/lib/php/extensions/ -name phalcon.so | grep phalcon; then \ + echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if find /usr/local/lib/php/extensions/ -name psr.so | grep psr; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + # Disable phalcon.so (and its requirement psr after installing) + post: | + if [ -f /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini ]; then \ + rm /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini; \ + fi \ + && if [ -f /usr/local/etc/php/conf.d/docker-php-ext-psr.ini ]; then \ + echo "extension=psr.so" > /usr/local/etc/php/conf.d/docker-php-ext-psr.ini; \ + fi \ + +7.1: + type: composer + version: 3.4.11 + +7.0: + type: composer + version: 3.4.11 + +5.6: + type: composer + version: 3.4.11 + +5.5: + type: composer + version: 3.4.11 + +# Disabled, as their symlink does not work. Filename: phalcon.php +# 5.4: +# type: composer +# version: 2.0.9 +# +# 5.3: +# type: composer +# version: 2.0.7 diff --git a/php_tools/phalcon-devtools/options.yml b/php_tools/phalcon-devtools/options.yml new file mode 100644 index 0000000..23132ce --- /dev/null +++ b/php_tools/phalcon-devtools/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: phalcon-devtools + +# Exclude module build/installation for the following PHP versions +exclude: [5.2, 5.3, 5.4, 8.2] # See ../../php_modules/phalcon/options.yml + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/php-cs-fixer/README.md b/php_tools/php-cs-fixer/README.md new file mode 100644 index 0000000..8896d08 --- /dev/null +++ b/php_tools/php-cs-fixer/README.md @@ -0,0 +1,8 @@ +# PHP Coding Standards Fixer + +The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes your code to follow standards; whether you want to follow PHP coding standards as defined in the PSR-1, PSR-2, etc., or other community driven ones like the Symfony one. You can also define your (team's) style through configuration. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/PHP-CS-Fixer/PHP-CS-Fixer | +| Website | https://cs.symfony.com/ | diff --git a/php_tools/php-cs-fixer/install.yml b/php_tools/php-cs-fixer/install.yml new file mode 100644 index 0000000..76fc6a0 --- /dev/null +++ b/php_tools/php-cs-fixer/install.yml @@ -0,0 +1,41 @@ +--- + +check: php-cs-fixer --version 2>&1 | grep -E 'Fixer\s+(version\s*)?[-_.0-9]+\s+' || (php-cs-fixer --version; false) + +all: + type: custom + command: curl -sS -k -L --fail -L "${PHP_CS_FIXER_URL}" -o /usr/local/bin/php-cs-fixer + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v3.phar" + post: chmod +x /usr/local/bin/php-cs-fixer + +7.3: + type: custom + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" + +7.2: + type: custom + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" + +7.1: + type: custom + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" + +7.0: + type: custom + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" + +5.6: + type: custom + pre: PHP_CS_FIXER_URL="https://cs.symfony.com/download/php-cs-fixer-v2.phar" + +5.5: + type: custom + pre: PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar" + +5.4: + type: custom + pre: PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar" + +5.3: + type: custom + pre: PHP_CS_FIXER_URL="https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.2.19/php-cs-fixer.phar" diff --git a/php_tools/php-cs-fixer/options.yml b/php_tools/php-cs-fixer/options.yml new file mode 100644 index 0000000..35c787f --- /dev/null +++ b/php_tools/php-cs-fixer/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: php-cs-fixer + +# Exclude module build/installation for the following PHP versions +exclude: [5.2, 8.2] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/phpcbf/README.md b/php_tools/phpcbf/README.md new file mode 100644 index 0000000..e430e3e --- /dev/null +++ b/php_tools/phpcbf/README.md @@ -0,0 +1,8 @@ +# PHP Code Beautifier and Fixer + +PHP Code Beautifier and Fixer fixes violations of a defined coding standard. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/squizlabs/PHP_CodeSniffer | +| Website | https://phpqa.io/projects/phpcbf.html | diff --git a/php_tools/phpcbf/install.yml b/php_tools/phpcbf/install.yml new file mode 100644 index 0000000..e24e5a9 --- /dev/null +++ b/php_tools/phpcbf/install.yml @@ -0,0 +1,17 @@ +--- + +check: phpcbf --version | grep -E 'version [0-9][.0-9]+' || (phpcbf --version; false) + +all: + type: custom + command: curl -sS -k -L --fail -L "${PHPCBF_URL}" -o /usr/local/bin/phpcbf + pre: PHPCBF_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar" + post: chmod +x /usr/local/bin/phpcbf + +5.3: + type: custom + pre: PHPCBF_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcbf.phar" + +5.2: + type: custom + pre: PHPCBF_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcbf.phar" diff --git a/php_tools/phpcbf/options.yml b/php_tools/phpcbf/options.yml new file mode 100644 index 0000000..eb0344b --- /dev/null +++ b/php_tools/phpcbf/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: phpcbf + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/phpcs/README.md b/php_tools/phpcs/README.md new file mode 100644 index 0000000..cc3abbe --- /dev/null +++ b/php_tools/phpcs/README.md @@ -0,0 +1,7 @@ +# PHP_CodeSniffer + +PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/squizlabs/PHP_CodeSniffer | diff --git a/php_tools/phpcs/install.yml b/php_tools/phpcs/install.yml new file mode 100644 index 0000000..9be7966 --- /dev/null +++ b/php_tools/phpcs/install.yml @@ -0,0 +1,17 @@ +--- + +check: phpcs --version | grep -E 'version [0-9][.0-9]+' || (phpcs --version; false) + +all: + type: custom + command: curl -sS -k -L --fail -L "${PHPCS_URL}" -o /usr/local/bin/phpcs + pre: PHPCS_URL="https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar" + post: chmod +x /usr/local/bin/phpcs + +5.3: + type: custom + pre: PHPCS_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcs.phar" + +5.2: + type: custom + pre: PHPCS_URL="https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.0/phpcs.phar" diff --git a/php_tools/phpcs/options.yml b/php_tools/phpcs/options.yml new file mode 100644 index 0000000..9e716a3 --- /dev/null +++ b/php_tools/phpcs/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: phpcs + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/phpmd/README.md b/php_tools/phpmd/README.md new file mode 100644 index 0000000..fec4afb --- /dev/null +++ b/php_tools/phpmd/README.md @@ -0,0 +1,8 @@ +# PHPMD + +PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/phpmd/phpmd | +| Website | https://phpmd.org/ | diff --git a/php_tools/phpmd/install.yml b/php_tools/phpmd/install.yml new file mode 100644 index 0000000..1b9459b --- /dev/null +++ b/php_tools/phpmd/install.yml @@ -0,0 +1,8 @@ +--- + +check: phpmd --version | grep -E '^PHPMD [0-9][.0-9]+' || (phpmd --version; false) + +all: + type: custom + command: curl -sS -k -L --fail https://phpmd.org/static/latest/phpmd.phar -L -o /usr/local/bin/phpmd + post: chmod +x /usr/local/bin/phpmd diff --git a/php_tools/phpmd/options.yml b/php_tools/phpmd/options.yml new file mode 100644 index 0000000..568270d --- /dev/null +++ b/php_tools/phpmd/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: phpmd + +# Exclude module build/installation for the following PHP versions +exclude: [5.2] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/phpunit/README.md b/php_tools/phpunit/README.md new file mode 100644 index 0000000..acf34a8 --- /dev/null +++ b/php_tools/phpunit/README.md @@ -0,0 +1,10 @@ +# PHPUnit + +PHPUnit is a programmer-oriented testing framework for PHP. +It is an instance of the xUnit architecture for unit testing frameworks. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Website | https://phpunit.de/ | +| GitHub | https://github.com/sebastianbergmann/phpunit | +| Versions | https://phpunit.de/supported-versions.html | diff --git a/php_tools/phpunit/install.yml b/php_tools/phpunit/install.yml new file mode 100644 index 0000000..039c140 --- /dev/null +++ b/php_tools/phpunit/install.yml @@ -0,0 +1,45 @@ +--- + +check: phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) + +all: + type: custom + command: | + if [ -n "${PHP_UNIT_VERSION}" ]; then \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit-${PHP_UNIT_VERSION}.phar"; \ + else \ + PHP_UNIT_URL="https://phar.phpunit.de/phpunit.phar"; \ + fi \ + && curl -sS -L --fail "${PHP_UNIT_URL}" -L -o /usr/local/bin/phpunit \ + build_dep: [] + run_dep: [] + pre: PHP_UNIT_VERSION="" + post: chmod +x /usr/local/bin/phpunit + +7.2: + type: custom + pre: PHP_UNIT_VERSION="8" + +7.1: + type: custom + pre: PHP_UNIT_VERSION="7" + +7.0: + type: custom + pre: PHP_UNIT_VERSION="6" + +5.6: + type: custom + pre: PHP_UNIT_VERSION="5" + +5.5: + type: custom + pre: PHP_UNIT_VERSION="4" + +5.4: + type: custom + pre: PHP_UNIT_VERSION="4" + +5.3: + type: custom + pre: PHP_UNIT_VERSION="4" diff --git a/php_tools/phpunit/options.yml b/php_tools/phpunit/options.yml new file mode 100644 index 0000000..b990fb6 --- /dev/null +++ b/php_tools/phpunit/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: phpunit + +# Exclude module build/installation for the following PHP versions +exclude: [5.2] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/pm2/README.md b/php_tools/pm2/README.md new file mode 100644 index 0000000..5c37626 --- /dev/null +++ b/php_tools/pm2/README.md @@ -0,0 +1,9 @@ +# PM2 + +PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/pm2 | +| GitHub | https://github.com/Unitech/pm2 | +| Website | https://pm2.keymetrics.io/ | diff --git a/php_tools/pm2/install.yml b/php_tools/pm2/install.yml new file mode 100644 index 0000000..8dd4a8c --- /dev/null +++ b/php_tools/pm2/install.yml @@ -0,0 +1,13 @@ +--- + +check: pm2 --no-daemon --version | tail -1 | grep -E '[0-9][.0-9]+' || (pm2 --no-daemon --version; false) + +all: + type: npm + package: pm2 + binary: pm2 + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/pm2/options.yml b/php_tools/pm2/options.yml new file mode 100644 index 0000000..f057c2a --- /dev/null +++ b/php_tools/pm2/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: pm2 + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/pwncat/README.md b/php_tools/pwncat/README.md new file mode 100644 index 0000000..ce9dd8e --- /dev/null +++ b/php_tools/pwncat/README.md @@ -0,0 +1,9 @@ +# pwncat + +Netcat on steroids with Firewall, IDS/IPS evasion, bind and reverse shell, self-injecting shell and port forwarding magic - and its fully scriptable with Python (PSE). + +| Platform | Url | +|----------|------------------------------------------------------------------| +| PyPI | https://pypi.org/project/pwncat/ | +| GitHub | https://github.com/cytopia/pwncat | +| Website | https://pwncat.org/ | diff --git a/php_tools/pwncat/install.yml b/php_tools/pwncat/install.yml new file mode 100644 index 0000000..6668348 --- /dev/null +++ b/php_tools/pwncat/install.yml @@ -0,0 +1,12 @@ +--- + +check: pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) + +all: + type: pip + version: + build_dep: [] + run_dep: [] + pre: + post: | + ln -s pwncat /usr/local/bin/netcat \ diff --git a/php_tools/pwncat/options.yml b/php_tools/pwncat/options.yml new file mode 100644 index 0000000..8c96520 --- /dev/null +++ b/php_tools/pwncat/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: pwncat + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/rsync/README.md b/php_tools/rsync/README.md new file mode 100644 index 0000000..8867e1a --- /dev/null +++ b/php_tools/rsync/README.md @@ -0,0 +1,8 @@ +# Rsync + +Rsync is a fast and extraordinarily versatile file copying tool for both remote and local files. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/WayneD/rsync | +| Website | https://rsync.samba.org/ | diff --git a/php_tools/rsync/install.yml b/php_tools/rsync/install.yml new file mode 100644 index 0000000..94a3751 --- /dev/null +++ b/php_tools/rsync/install.yml @@ -0,0 +1,7 @@ +--- + +check: rsync --version | grep version | grep -E '[0-9]\.[0-9]+' || (rsync --version; false) + +all: + type: apt + package: rsync diff --git a/php_tools/rsync/options.yml b/php_tools/rsync/options.yml new file mode 100644 index 0000000..1af36c5 --- /dev/null +++ b/php_tools/rsync/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: rsync + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [ssh] diff --git a/php_tools/sass/README.md b/php_tools/sass/README.md new file mode 100644 index 0000000..5915786 --- /dev/null +++ b/php_tools/sass/README.md @@ -0,0 +1,10 @@ +# sass + +A pure JavaScript implementation of Sass. Sass makes CSS fun again. + +This package is a distribution of Dart Sass, compiled to pure JavaScript with no native code or external dependencies. It provides a command-line sass executable and a Node.js API. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/sass | +| GitHub | https://github.com/sass/dart-sass | diff --git a/php_tools/sass/install.yml b/php_tools/sass/install.yml new file mode 100644 index 0000000..3a5b40b --- /dev/null +++ b/php_tools/sass/install.yml @@ -0,0 +1,13 @@ +--- + +check: sass --version | grep -E '[0-9][.0-9]+' || (sass --version; false) + +all: + type: npm + package: sass + binary: sass + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/sass/options.yml b/php_tools/sass/options.yml new file mode 100644 index 0000000..af69177 --- /dev/null +++ b/php_tools/sass/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: sass + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/shellcheck/README.md b/php_tools/shellcheck/README.md new file mode 100644 index 0000000..c8b380f --- /dev/null +++ b/php_tools/shellcheck/README.md @@ -0,0 +1,7 @@ +# ShellCheck + +ShellCheck is a GPLv3 tool that gives warnings and suggestions for bash/sh shell scripts. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/koalaman/shellcheck | diff --git a/php_tools/shellcheck/install.yml b/php_tools/shellcheck/install.yml new file mode 100644 index 0000000..c77f4fc --- /dev/null +++ b/php_tools/shellcheck/install.yml @@ -0,0 +1,7 @@ +--- + +check: shellcheck --version | grep -E '[0-9][.0-9]+' || (shellcheck --version; false) + +all: + type: apt + package: shellcheck diff --git a/php_tools/shellcheck/options.yml b/php_tools/shellcheck/options.yml new file mode 100644 index 0000000..0f1e7a6 --- /dev/null +++ b/php_tools/shellcheck/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: shellcheck + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/ssh/README.md b/php_tools/ssh/README.md new file mode 100644 index 0000000..01ab6de --- /dev/null +++ b/php_tools/ssh/README.md @@ -0,0 +1,7 @@ +# OpenSSH Client + +OpenSSH Client is a program for logging into a remote machine and for executing commands on a remote machine. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Website | https://www.openssh.com/ | diff --git a/php_tools/ssh/install.yml b/php_tools/ssh/install.yml new file mode 100644 index 0000000..753717b --- /dev/null +++ b/php_tools/ssh/install.yml @@ -0,0 +1,7 @@ +--- + +check: ssh -V 2>&1 | grep ^OpenSSH || (ssh -V; false) + +all: + type: apt + package: openssh-client diff --git a/php_tools/ssh/options.yml b/php_tools/ssh/options.yml new file mode 100644 index 0000000..863453e --- /dev/null +++ b/php_tools/ssh/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: ssh + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/stylelint/README.md b/php_tools/stylelint/README.md new file mode 100644 index 0000000..98607e3 --- /dev/null +++ b/php_tools/stylelint/README.md @@ -0,0 +1,8 @@ +# Stylelint + +A mighty, modern linter that helps you avoid errors and enforce conventions in your styles. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/stylelint | +| GitHub | https://github.com/stylelint/stylelint | diff --git a/php_tools/stylelint/install.yml b/php_tools/stylelint/install.yml new file mode 100644 index 0000000..e36c7e1 --- /dev/null +++ b/php_tools/stylelint/install.yml @@ -0,0 +1,13 @@ +--- + +check: stylelint --version | grep -E '[0-9][.0-9]+' || (stylelint --version; false) + +all: + type: npm + package: stylelint + binary: stylelint + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/stylelint/options.yml b/php_tools/stylelint/options.yml new file mode 100644 index 0000000..d75d55e --- /dev/null +++ b/php_tools/stylelint/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: stylelint + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/svn/README.md b/php_tools/svn/README.md new file mode 100644 index 0000000..28102bb --- /dev/null +++ b/php_tools/svn/README.md @@ -0,0 +1,7 @@ +# Subversion + +https://subversion.apache.org/ + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Website | https://subversion.apache.org/ | diff --git a/php_tools/svn/install.yml b/php_tools/svn/install.yml new file mode 100644 index 0000000..71630a1 --- /dev/null +++ b/php_tools/svn/install.yml @@ -0,0 +1,7 @@ +--- + +check: svn --version | grep version | grep -E '[0-9]+\.[0-9]+' || (svn --version; false) + +all: + type: apt + package: subversion diff --git a/php_tools/svn/options.yml b/php_tools/svn/options.yml new file mode 100644 index 0000000..b2c86e0 --- /dev/null +++ b/php_tools/svn/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: svn + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/symfony-cli/README.md b/php_tools/symfony-cli/README.md new file mode 100644 index 0000000..3dda3f6 --- /dev/null +++ b/php_tools/symfony-cli/README.md @@ -0,0 +1,7 @@ +# Symfony CLI + +The Symfony binary is a must-have tool when developing Symfony applications on your local machine + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/symfony-cli/symfony-cli | diff --git a/php_tools/symfony-cli/install.yml b/php_tools/symfony-cli/install.yml new file mode 100644 index 0000000..e18ef2e --- /dev/null +++ b/php_tools/symfony-cli/install.yml @@ -0,0 +1,9 @@ +--- + +check: symfony --no-ansi -V | grep -E 'version [0-9][.0-9]+' || (symfony --no-ansi -V; false) + +all: + type: custom + command: curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir /usr/local/bin + build_dep: [] + run_dep: [] diff --git a/php_tools/symfony-cli/options.yml b/php_tools/symfony-cli/options.yml new file mode 100644 index 0000000..ac940cc --- /dev/null +++ b/php_tools/symfony-cli/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: symfony-cli + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/taskfile/README.md b/php_tools/taskfile/README.md new file mode 100644 index 0000000..176e564 --- /dev/null +++ b/php_tools/taskfile/README.md @@ -0,0 +1,8 @@ +# taskfile + +Task is a task runner / build tool that aims to be simpler and easier to use than, for example, GNU Make. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/go-task/task | +| Website | https://taskfile.dev/ | diff --git a/php_tools/taskfile/install.yml b/php_tools/taskfile/install.yml new file mode 100644 index 0000000..4d05da5 --- /dev/null +++ b/php_tools/taskfile/install.yml @@ -0,0 +1,7 @@ +--- + +check: task --version | grep -E '[0-9][.0-9]+' || (task --version; false) + +all: + type: custom + command: sh -c "$(curl -sS -K --fail -k https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin/ diff --git a/php_tools/taskfile/options.yml b/php_tools/taskfile/options.yml new file mode 100644 index 0000000..4f8f28f --- /dev/null +++ b/php_tools/taskfile/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: taskfile + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/tig/README.md b/php_tools/tig/README.md new file mode 100644 index 0000000..168fde7 --- /dev/null +++ b/php_tools/tig/README.md @@ -0,0 +1,8 @@ +# Tig: text-mode interface for Gi + +Tig is an ncurses-based text-mode interface for git. It functions mainly as a Git repository browser, but can also assist in staging changes for commit at chunk level and act as a pager for output from various Git commands. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/jonas/tig | +| Website | https://jonas.github.io/tig/ | diff --git a/php_tools/tig/install.yml b/php_tools/tig/install.yml new file mode 100644 index 0000000..92cc0a0 --- /dev/null +++ b/php_tools/tig/install.yml @@ -0,0 +1,7 @@ +--- + +check: tig --version 2>&1 | grep -E '[0-9][.0-9]+' || (tig --version; false) + +all: + type: apt + package: tig diff --git a/php_tools/tig/options.yml b/php_tools/tig/options.yml new file mode 100644 index 0000000..9a757e2 --- /dev/null +++ b/php_tools/tig/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: tig + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [git] diff --git a/php_tools/vim/README.md b/php_tools/vim/README.md new file mode 100644 index 0000000..5edac07 --- /dev/null +++ b/php_tools/vim/README.md @@ -0,0 +1,7 @@ +# Vim + +Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| Website | https://www.vim.org/ | diff --git a/php_tools/vim/install.yml b/php_tools/vim/install.yml new file mode 100644 index 0000000..8551ab0 --- /dev/null +++ b/php_tools/vim/install.yml @@ -0,0 +1,7 @@ +--- + +check: vim --version | grep ^VIM | grep -E '[0-9]\.[0-9]+' || (vim --version; false) + +all: + type: apt + package: vim diff --git a/php_tools/vim/options.yml b/php_tools/vim/options.yml new file mode 100644 index 0000000..d2ccf48 --- /dev/null +++ b/php_tools/vim/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: vim + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/vue-cli/README.md b/php_tools/vue-cli/README.md new file mode 100644 index 0000000..803e9a6 --- /dev/null +++ b/php_tools/vue-cli/README.md @@ -0,0 +1,10 @@ +# Vue CLI + +Vue CLI is the Standard Tooling for Vue.js Development. + +**Note:** Vue CLI is now in maintenance mode. For new projects, please use create-vue to scaffold Vite-based projects. create-vue supports both Vue 2 and Vue 3. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/@vue/cli | +| GitHub | https://github.com/vuejs/vue-cli | diff --git a/php_tools/vue-cli/install.yml b/php_tools/vue-cli/install.yml new file mode 100644 index 0000000..57c73f5 --- /dev/null +++ b/php_tools/vue-cli/install.yml @@ -0,0 +1,13 @@ +--- + +check: vue --version | grep -E '[0-9][.0-9]+' || (vue --version; false) + +all: + type: npm + package: "@vue/cli" + binary: vue + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/vue-cli/options.yml b/php_tools/vue-cli/options.yml new file mode 100644 index 0000000..e266ce4 --- /dev/null +++ b/php_tools/vue-cli/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: vue-cli + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/webpack-cli/README.md b/php_tools/webpack-cli/README.md new file mode 100644 index 0000000..fd4b1ec --- /dev/null +++ b/php_tools/webpack-cli/README.md @@ -0,0 +1,8 @@ +# webpack CLI + +webpack CLI provides a flexible set of commands for developers to increase speed when setting up a custom webpack project. As of webpack v4, webpack is not expecting a configuration file, but often developers want to create a more custom webpack configuration based on their use-cases and needs. webpack CLI addresses these needs by providing a set of tools to improve the setup of custom webpack configuration. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| NPM | https://www.npmjs.com/package/webpack-cli | +| GitHub | https://github.com/webpack/webpack-cli | diff --git a/php_tools/webpack-cli/install.yml b/php_tools/webpack-cli/install.yml new file mode 100644 index 0000000..69b579f --- /dev/null +++ b/php_tools/webpack-cli/install.yml @@ -0,0 +1,13 @@ +--- + +check: webpack-cli --version | grep -E '[0-9][.0-9]+' || (webpack-cli --version; false) + +all: + type: npm + package: webpack-cli + binary: webpack-cli + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/webpack-cli/options.yml b/php_tools/webpack-cli/options.yml new file mode 100644 index 0000000..35f15da --- /dev/null +++ b/php_tools/webpack-cli/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: webpack-cli + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/wkhtmltopdf/README.md b/php_tools/wkhtmltopdf/README.md new file mode 100644 index 0000000..0036202 --- /dev/null +++ b/php_tools/wkhtmltopdf/README.md @@ -0,0 +1,8 @@ +# wkhtmltopdf + +`wkhtmltopdf` and `wkhtmltoimage` are command line tools to render HTML into PDF and various image formats using the QT Webkit rendering engine. These run entirely "headless" and do not require a display or display service. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/wkhtmltopdf/wkhtmltopdf | +| Website | https://wkhtmltopdf.org/ | diff --git a/php_tools/wkhtmltopdf/install.yml b/php_tools/wkhtmltopdf/install.yml new file mode 100644 index 0000000..286f7d0 --- /dev/null +++ b/php_tools/wkhtmltopdf/install.yml @@ -0,0 +1,61 @@ +--- + +check: wkhtmltopdf --version | grep ^wkhtmltopdf | grep -E '[0-9]\.[0-9]+' | grep patched || (wkhtmltopdf --version; false) + +all: + type: custom + pre: OS_RELEASE="bullseye" + command: | + DEB_HOST_ARCH="$( dpkg-architecture --query DEB_HOST_ARCH )" \ + && WK_URL="$( \ + curl -sSL -L --fail https://api.github.com/repos/wkhtmltopdf/packaging/releases \ + | awk -F\" "/wkhtmltopdf.*.${OS_RELEASE}_${DEB_HOST_ARCH}\.deb/{print \$(NF-1)}" \ + | head -1 \ + )" \ + && echo "URL: ${WK_URL}" \ + && curl -sS -L --fail -o /tmp/wkhtmltopdf.deb "${WK_URL}" \ + && dpkg -i /tmp/wkhtmltopdf.deb \ + && rm -f /tmp/wkhtmltopdf.deb \ + run_dep: + - fontconfig + - libfontenc1 + - libxfont2 + - libxrender1 + - xfonts-75dpi + - xfonts-base + - xfonts-encodings + - xfonts-utils + +7.2: + type: custom + pre: OS_RELEASE="buster" + +7.1: + type: custom + pre: OS_RELEASE="buster" + +7.0: + type: custom + pre: OS_RELEASE="stretch" + run_dep: + - fontconfig + - libfontenc1 + - libxfont1 + - libxrender1 + - xfonts-75dpi + - xfonts-base + - xfonts-encodings + - xfonts-utils + +5.6: + type: custom + pre: OS_RELEASE="stretch" + run_dep: + - fontconfig + - libfontenc1 + - libxfont1 + - libxrender1 + - xfonts-75dpi + - xfonts-base + - xfonts-encodings + - xfonts-utils diff --git a/php_tools/wkhtmltopdf/options.yml b/php_tools/wkhtmltopdf/options.yml new file mode 100644 index 0000000..4f5fdca --- /dev/null +++ b/php_tools/wkhtmltopdf/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: wkhtmltopdf + +# Exclude module build/installation for the following PHP versions +exclude: [5.2, 5.3, 5.4, 5.5] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/wp-cli/README.md b/php_tools/wp-cli/README.md new file mode 100644 index 0000000..ea2d5e3 --- /dev/null +++ b/php_tools/wp-cli/README.md @@ -0,0 +1,7 @@ +# WP-CLI + +WP-CLI is the command-line interface for WordPress. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/wp-cli/wp-cli | diff --git a/php_tools/wp-cli/install.yml b/php_tools/wp-cli/install.yml new file mode 100644 index 0000000..4039379 --- /dev/null +++ b/php_tools/wp-cli/install.yml @@ -0,0 +1,23 @@ +--- + +check: wp --allow-root --version | grep -E '[0-9][.0-9]+' || (wp --allow-root --version; false) + +all: + type: custom + command: curl -sS -L --fail "${WPCLI_URL}" -L -o /usr/local/bin/wp + build_dep: [] + run_dep: [] + pre: WPCLI_URL="https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" + post: chmod +x /usr/local/bin/wp + +5.5: + type: custom + pre: WPCLI_URL="https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar" + +5.4: + type: custom + pre: WPCLI_URL="https://github.com/wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar" + +5.3: + type: custom + pre: WPCLI_URL="https://github.com/wp-cli/wp-cli/releases/download/v1.5.1/wp-cli-1.5.1.phar" diff --git a/php_tools/wp-cli/options.yml b/php_tools/wp-cli/options.yml new file mode 100644 index 0000000..cc6cf9b --- /dev/null +++ b/php_tools/wp-cli/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: wp-cli + +# Exclude module build/installation for the following PHP versions +exclude: [5.2] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/yamllint/README.md b/php_tools/yamllint/README.md new file mode 100644 index 0000000..87956ac --- /dev/null +++ b/php_tools/yamllint/README.md @@ -0,0 +1,8 @@ +# yamllint + +A linter for YAML files. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| PyPI | https://pypi.org/project/yamllint/ | +| GitHub | https://github.com/adrienverge/yamllint | diff --git a/php_tools/yamllint/install.yml b/php_tools/yamllint/install.yml new file mode 100644 index 0000000..1067f94 --- /dev/null +++ b/php_tools/yamllint/install.yml @@ -0,0 +1,11 @@ +--- + +check: yamllint --version 2>&1 | grep -E '[0-9][.0-9]+' || (yamllint --version; false) + +all: + type: pip + version: + build_dep: [] + run_dep: [] + # pre: + # post: diff --git a/php_tools/yamllint/options.yml b/php_tools/yamllint/options.yml new file mode 100644 index 0000000..48622f8 --- /dev/null +++ b/php_tools/yamllint/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: yamllint + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/php_tools/yq/README.md b/php_tools/yq/README.md new file mode 100644 index 0000000..963429b --- /dev/null +++ b/php_tools/yq/README.md @@ -0,0 +1,8 @@ +# yq + +Command-line YAML/XML/TOML processor. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| PyPI | https://pypi.org/project/yq/ | +| GitHub | https://github.com/kislyuk/yq | diff --git a/php_tools/yq/install.yml b/php_tools/yq/install.yml new file mode 100644 index 0000000..de3d0e0 --- /dev/null +++ b/php_tools/yq/install.yml @@ -0,0 +1,11 @@ +--- + +check: yq --version 2>&1 | grep -E '[0-9][.0-9]+' || (yq --version; false) + +all: + type: pip + version: + build_dep: [] + run_dep: [] + pre: + post: diff --git a/php_tools/yq/options.yml b/php_tools/yq/options.yml new file mode 100644 index 0000000..23472b8 --- /dev/null +++ b/php_tools/yq/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: yq + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [jq] diff --git a/php_tools/zsh/README.md b/php_tools/zsh/README.md new file mode 100644 index 0000000..1bcfbaa --- /dev/null +++ b/php_tools/zsh/README.md @@ -0,0 +1,8 @@ +# Zsh + +Zsh is a shell designed for interactive use, although it is also a powerful scripting language. + +| Platform | Url | +|----------|------------------------------------------------------------------| +| GitHub | https://github.com/zsh-users/zsh | +| Website | https://www.zsh.org/ | diff --git a/php_tools/zsh/install.yml b/php_tools/zsh/install.yml new file mode 100644 index 0000000..821ba31 --- /dev/null +++ b/php_tools/zsh/install.yml @@ -0,0 +1,7 @@ +--- + +check: zsh --version 2>&1 | grep -E '[0-9][.0-9]+' || (zsh --version; false) + +all: + type: apt + package: zsh diff --git a/php_tools/zsh/options.yml b/php_tools/zsh/options.yml new file mode 100644 index 0000000..ee19dbc --- /dev/null +++ b/php_tools/zsh/options.yml @@ -0,0 +1,11 @@ +--- + +# The name of the module +name: zsh + +# Exclude module build/installation for the following PHP versions +exclude: [] + +# In order for this tool to build/install correctly, +# the following tools must have been installed first. +depends: [] diff --git a/tests/work/01-test-env-mysqldump-secure.sh b/tests/slim/01-test-env-mysqldump-secure.sh similarity index 100% rename from tests/work/01-test-env-mysqldump-secure.sh rename to tests/slim/01-test-env-mysqldump-secure.sh diff --git a/tests/test.sh b/tests/test.sh index 032d630..98fdee3 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -45,7 +45,7 @@ TAG="${5}" ### ### Run tests ### -if [ "${FLAVOUR}" = "base" ] || [ "${FLAVOUR}" = "mods" ] || [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "work" ]; then +if [ "${FLAVOUR}" = "base" ] || [ "${FLAVOUR}" = "mods" ] || [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "slim" ] || [ "${FLAVOUR}" = "work" ]; then TESTS="$( find "${CWD}" -regex "${CWD}/base/[0-9].+.*\.sh" | sort -u )" for t in ${TESTS}; do printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################" @@ -56,7 +56,7 @@ if [ "${FLAVOUR}" = "base" ] || [ "${FLAVOUR}" = "mods" ] || [ "${FLAVOUR}" = "p done fi -if [ "${FLAVOUR}" = "mods" ] || [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "work" ]; then +if [ "${FLAVOUR}" = "mods" ] || [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "slim" ] || [ "${FLAVOUR}" = "work" ]; then TESTS="$( find "${CWD}" -regex "${CWD}/mods/[0-9].+.*\.sh" | sort -u )" for t in ${TESTS}; do printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################" @@ -67,7 +67,7 @@ if [ "${FLAVOUR}" = "mods" ] || [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "w done fi -if [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "work" ]; then +if [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "slim" ] || [ "${FLAVOUR}" = "work" ]; then TESTS="$( find "${CWD}" -regex "${CWD}/prod/[0-9].+.*\.sh" | sort -u )" for t in ${TESTS}; do printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################" @@ -78,8 +78,8 @@ if [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "work" ]; then done fi -if [ "${FLAVOUR}" = "work" ]; then - TESTS="$( find "${CWD}" -regex "${CWD}/work/[0-9].+.*\.sh" | sort -u )" +if [ "${FLAVOUR}" = "slim" ] || [ "${FLAVOUR}" = "work" ]; then + TESTS="$( find "${CWD}" -regex "${CWD}/slim/[0-9].+.*\.sh" | sort -u )" for t in ${TESTS}; do printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################" printf "\033[0;33m%s %s\033[0m\n" "#" "[${VERSION}-${FLAVOUR}] (${ARCH})"