Skip to content

Commit 825bc41

Browse files
committed
Add Abuser documentation
1 parent c722d4c commit 825bc41

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

doc/abuser/README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
Build your own image
2+
3+
---
4+
5+
<h2><img name="Documentation" title="Documentation" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Abuser Documentation</h2>
6+
7+
8+
9+
### Build your own image
10+
11+
#### Software Requirements
12+
13+
You must have the following tools installed locally:
14+
* Python3
15+
* `PyYAML` Python package (either via pip or OS packet manager)
16+
* `make`
17+
* `docker`
18+
19+
20+
#### Other Requirements
21+
You should have a brief understanding about the different flavours available in this repository.
22+
23+
:information_source: For details see **[README.md#flavours](../../README.md#php-fpm-flavours)**<br/>
24+
:information_source: For details see **[Documentation: Flavours](../flavours.md)**
25+
26+
27+
#### How does it work?
28+
29+
This repository already has all the automation in place.
30+
31+
1. For each PHP version a `base` image is built to streamline settings across all PHP versions.
32+
2. Based on the `base` image, a `mods` image is built, which only adds a whole bunch of PHP extensions.
33+
3. Based on the `mods` image, a `prod` image is built, which adds features to alter the startup behaviour.
34+
4. Based on the `prod` image, a `work` image is built, which acts as an integrated development environment in which you can actually work (adds a whole bunch of tools).
35+
36+
What you need to do, is to:
37+
38+
1. Ensure the `base` image is available locally on your system (either by building it or by pulling it).
39+
2. Decide on the PHP extensions that you want to add
40+
3. Decide on the PHP version you want to build
41+
4. Decide on the architecture/platform you want to build the Docker image for (`amd64` or `arm64`).
42+
5. Build the `mods` image (or just create the Dockerfile for it).
43+
44+
With this you will be all set, you can however decide to build the `prod` flavour on top of your custom `mods` image as it adds a lot of configurable environment variables to dynamically alter the startup behaviour.
45+
46+
In case you plan to use your custom image for the **[Devilbox](https://github.com/cytopia/devilbox)**, you must also go ahead and built the `work` flavour on top of the `prod` flavour.
47+
48+
49+
#### Generate your custom Dockerfile
50+
51+
> **Note:** All commands are executed in the root of this repository
52+
53+
1. Generate PHP extensions in Ansible group_vars
54+
```bash
55+
# Generate Ansible group_vars for all available extensions
56+
make gen-modules
57+
```
58+
```bash
59+
# Generate Ansible group_vars for selected extensions
60+
# Note: that also all dependent extensions will be added
61+
make gen-modules ARGS="msgpack xsl"
62+
```
63+
```bash
64+
# Generate Ansible group_vars for selected extensions
65+
# and ignore dependencies
66+
make gen-modules ARGS="-i msgpack xsl"
67+
```
68+
```bash
69+
# Show help
70+
make gen-modules ARGS="--help"
71+
```
72+
2. Generate Dockerfiles from Ansible group_vars
73+
```bash
74+
make gen-dockerfiles
75+
```
76+
77+
78+
#### Build your custom Dockerfile
79+
80+
> **Note:** All commands are executed in the root of this repository
81+
82+
1. Ensure you have the `base` image locally for your desired version and architecture
83+
```bash
84+
ARCH=linux/amd64
85+
VERSION=8.1
86+
make docker-pull-base-image STAGE=mods VERSION=${VERSION} ARCH=${ARCH}
87+
```
88+
2. Build the `mods` image
89+
```bash
90+
ARCH=linux/amd64
91+
VERSION=8.1
92+
make build STAGE=mods VERSION=${VERSION} ARCH=${ARCH}
93+
```
94+
3. (Optional) Build the `prod` image
95+
```bash
96+
ARCH=linux/amd64
97+
VERSION=8.1
98+
make build STAGE=prod VERSION=${VERSION} ARCH=${ARCH}
99+
```
100+
4. (Optional) Build the `work` image
101+
```bash
102+
ARCH=linux/amd64
103+
VERSION=8.1
104+
make build STAGE=work VERSION=${VERSION} ARCH=${ARCH}
105+
```
106+
107+
108+
#### FAQ
109+
110+
1. Where do I find the generated Dockerfile?
111+
2. How can I omit dependent PHP extensions when generating the Dockerfile?
112+
3. How do I ensure that dependent PHP extensions are automatically added to the Dockerfile?
113+
4. Where do I see what PHP extensions are available in this repository?
114+
5. How do I know what each of the provided PHP extensions is for?
115+
6. How can I add PHP extensions that are not provided here?
116+
7. Switching architectures fails with errors, what should I do?

0 commit comments

Comments
 (0)