mirror of
https://github.com/devilbox/docker-php-fpm.git
synced 2025-12-10 11:01:14 +00:00
Use a single command to generate Dockerfiles
This commit is contained in:
5
.github/workflows/linting.yml
vendored
5
.github/workflows/linting.yml
vendored
@@ -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
|
||||
|
||||
20
Makefile
20
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 \
|
||||
|
||||
@@ -440,13 +440,10 @@ Docker images are built and tested every night by **[GitHub Actions](https://git
|
||||
<h2><img id="build-your-own-image" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Build your own image</h2>
|
||||
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)**
|
||||
|
||||
Reference in New Issue
Block a user