Skip to content

Commit

Permalink
Optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed Dec 7, 2022
1 parent 0126289 commit 887e7c6
Show file tree
Hide file tree
Showing 22 changed files with 82 additions and 207 deletions.
6 changes: 4 additions & 2 deletions .ansible/DOCKERFILES/Dockerfile-work.j2
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,14 @@ RUN set -eux \
{%- 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_binary = fn.tool_composer_get_binary(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 {{ comp_package }}{{ comp_version }} \
{{ "\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] -#}
Expand Down
18 changes: 0 additions & 18 deletions .ansible/group_vars/all/work-help.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@ 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


# -------------------------------------------------------------------------------------------------
# Software to install (in defined order)
Expand Down
16 changes: 3 additions & 13 deletions .ansible/group_vars/all/work.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ tools_enabled:
- lumen
- mdl
- phpunit
- prestissimo
- pwncat
- wpcli
- yamllint
Expand Down Expand Up @@ -42,6 +41,7 @@ tools_available:
package: asgardcms/asgardcms-installer
# https://github.com/AsgardCms/asgardcms-installer/issues/1
version: dev-master
flags:
binary: asgardcms
build_dep: []
run_dep: []
Expand All @@ -55,6 +55,7 @@ tools_available:
composer: 2
package: codeception/codeception
# version:
flags:
binary: codecept
build_dep: []
run_dep: []
Expand Down Expand Up @@ -86,6 +87,7 @@ tools_available:
composer: 2
package: laravel/lumen-installer
# version:
flags:
binary: lumen
build_dep: []
run_dep: []
Expand Down Expand Up @@ -173,18 +175,6 @@ tools_available:
5.3:
type: custom
pre: PHP_UNIT_VERSION="4"
prestissimo:
disabled: [5.2]
all:
type: composer
composer: 1
package: hirak/prestissimo
# version:
# binary:
build_dep: []
run_dep: []
# pre:
# post:
pwncat:
disabled: []
check: pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false)
Expand Down
10 changes: 10 additions & 0 deletions .ansible/jinja2/macros-work.j2
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@
{%- 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'
Expand Down
9 changes: 0 additions & 9 deletions Dockerfiles/work/Dockerfile-5.3
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pip install --no-cache-dir --no-compile --force-reinstall pwncat \
Expand Down Expand Up @@ -431,10 +426,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \
Expand Down
12 changes: 2 additions & 10 deletions Dockerfiles/work/Dockerfile-5.4
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,9 @@ RUN set -eux \
# -------------------- (composer) codeception --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \
&& 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
Expand Down Expand Up @@ -300,11 +301,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pip install --no-cache-dir --no-compile --force-reinstall pwncat \
Expand Down Expand Up @@ -443,10 +439,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \
Expand Down
18 changes: 6 additions & 12 deletions Dockerfiles/work/Dockerfile-5.5
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,17 @@ RUN set -eux \
# -------------------- (composer) asgardcms --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer:dev-master \
&& 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
# -------------------- (composer) codeception --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \
&& 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
Expand All @@ -293,8 +295,9 @@ RUN set -eux \
# -------------------- (composer) lumen --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \
&& 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 -E '^Lumen Installer\s[0-9][.0-9]+$' || (lumen --version; false) \
&& true
Expand All @@ -314,11 +317,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pip install --no-cache-dir --no-compile --force-reinstall pwncat \
Expand Down Expand Up @@ -467,10 +465,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \
Expand Down
18 changes: 6 additions & 12 deletions Dockerfiles/work/Dockerfile-5.6
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,17 @@ RUN set -eux \
# -------------------- (composer) asgardcms --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer:dev-master \
&& 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
# -------------------- (composer) codeception --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \
&& 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
Expand All @@ -293,8 +295,9 @@ RUN set -eux \
# -------------------- (composer) lumen --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \
&& 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 -E '^Lumen Installer\s[0-9][.0-9]+$' || (lumen --version; false) \
&& true
Expand All @@ -314,11 +317,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pip install --no-cache-dir --no-compile --force-reinstall pwncat \
Expand Down Expand Up @@ -467,10 +465,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \
Expand Down
18 changes: 6 additions & 12 deletions Dockerfiles/work/Dockerfile-7.0
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,17 @@ RUN set -eux \
# -------------------- (composer) asgardcms --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer:dev-master \
&& 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
# -------------------- (composer) codeception --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \
&& 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
Expand All @@ -293,8 +295,9 @@ RUN set -eux \
# -------------------- (composer) lumen --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \
&& 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 -E '^Lumen Installer\s[0-9][.0-9]+$' || (lumen --version; false) \
&& true
Expand All @@ -314,11 +317,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pip install --no-cache-dir --no-compile --force-reinstall pwncat \
Expand Down Expand Up @@ -467,10 +465,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \
Expand Down
18 changes: 6 additions & 12 deletions Dockerfiles/work/Dockerfile-7.1
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,17 @@ RUN set -eux \
# -------------------- (composer) asgardcms --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require asgardcms/asgardcms-installer:dev-master \
&& 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
# -------------------- (composer) codeception --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require codeception/codeception \
&& 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
Expand All @@ -293,8 +295,9 @@ RUN set -eux \
# -------------------- (composer) lumen --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-2 global require laravel/lumen-installer \
&& 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 -E '^Lumen Installer\s[0-9][.0-9]+$' || (lumen --version; false) \
&& true
Expand All @@ -314,11 +317,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& COMPOSER_HOME="/usr/local/src/composer" COMPOSER_MEMORY_LIMIT=-1 /usr/local/bin/composer-1 global require hirak/prestissimo \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pip install --no-cache-dir --no-compile --force-reinstall pwncat \
Expand Down Expand Up @@ -467,10 +465,6 @@ RUN set -eux \
&& phpunit --version | grep -iE '^PHPUnit\s[0-9][.0-9]+' || (phpunit --version; false) \
&& true
# -------------------- (composer) prestissimo --------------------
RUN set -eux \
&& true
# -------------------- (pip) pwncat --------------------
RUN set -eux \
&& pwncat --version 2>&1 | grep -E 'Version [0-9][.0-9]+' || (pwncat --version; false) \
Expand Down
Loading

0 comments on commit 887e7c6

Please sign in to comment.