From 69ffc63607b9d762cbe1be095dce64a9b3c422c9 Mon Sep 17 00:00:00 2001 From: cytopia Date: Wed, 7 Dec 2022 12:13:41 +0100 Subject: [PATCH] Use a single command to generate Dockerfiles --- .github/workflows/linting.yml | 5 ----- Makefile | 20 +++++++++++++------- README.md | 9 +++------ doc/abuser/README.md | 32 ++++++++++++-------------------- php_modules/README.md | 10 ++++------ 5 files changed, 32 insertions(+), 44 deletions(-) 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/Makefile b/Makefile index e319b7c..dd59de1 100644 --- a/Makefile +++ b/Makefile @@ -231,18 +231,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/modules-generate.py $(MODS) + @echo + @echo "################################################################################" + @echo "# Generating Tools" + @echo "################################################################################" + ./bin/tools-generate.py $(TOOLS) + @echo + @echo "################################################################################" + @echo "# Generating Dockerfiles" + @echo "################################################################################" docker run --rm \ $$(tty -s && echo "-it" || echo) \ -e USER=ansible \ diff --git a/README.md b/README.md index 81f6baa..4590df4 100644 --- a/README.md +++ b/README.md @@ -440,13 +440,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 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/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)**