You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
@@ -15,8 +15,8 @@ You can use the built-in extension mechanism of Docker to specify [multiple comp
15
15
version: '2'
16
16
services:
17
17
deploy:
18
-
environment:
19
-
- ENABLE_SENDMAIL=false
18
+
environment:
19
+
- ENABLE_SENDMAIL=false
20
20
```
21
21
22
22
1. Pass both configuration files while executing your commands. For example:
@@ -27,17 +27,16 @@ You can use the built-in extension mechanism of Docker to specify [multiple comp
27
27
28
28
## Specify Docker build sources
29
29
30
-
To test changes to images or make more extensive changes to the containers, you must build them from source. You can do this by
31
-
by adding the `build:context` configuration to the `docker-compose.override.yml` file.
30
+
To test changes to images or make more extensive changes to the containers, you must build them from source. You can do this by adding the `build:context` configuration to the `docker-compose.override.yml` file.
32
31
33
32
The following example defines the build context for the Web container. You can use the same technique to build from any of the images in the `vendor/magento/magento-cloud-docker` directory or any other Docker image, including local images that are resourced outside the project.
To update the container configuration and test iteratively, use the `--force-recreate` option to refresh the container build:
@@ -48,64 +47,111 @@ docker-compose up -d --force-recreate --build
48
47
49
48
## Add a new version of existing service
50
49
51
-
In {{site.data.var.mcd}} package the available [service versions] are determined by the Docker service images configured in the {{site.data.var.mcd}} `images` directory. You can add a new service version by creating a directory for the version and adding a `Dockerfile` and other files to configure the new version.
50
+
In the `{{site.data.var.mcd-package}}` package, the available [service versions] are determined by the Docker service images configured in the `images` directory. You add a new service version by creating a directory for the version and adding a `Dockerfile` and other files to configure the new version.
52
51
53
52
{:.procedure}
54
53
To add a new service version using a `Dockerfile`:
55
54
56
-
1. Clone the `{{site.data.var.mcd}}` project to your local environment if necessary.
55
+
1. Clone the `{{site.data.var.mcd-package}}` project to your local environment if necessary.
57
56
58
57
1. On the command line, change to the directory that contains the existing service version configurations.
59
58
60
59
```bash
61
-
cd magento-cloud-docker/images/<service-name>
60
+
cd magento-cloud-docker/images/<service-name>
62
61
```
63
62
64
63
1. Create a directory for the new version.
65
64
66
-
1. In the new directory, add the `Dockerfile` that contains the image configuration details for the new version. Use the `Dockerfile` for an existing version as a template and add any other required configuration such as supported plugins.
65
+
1. Change to the new directory.
66
+
67
+
1. Create a `Dockerfile` with any additional configuration details for the new version, such as supported plugins. You can use the `Dockerfile` from the previous version as a template.
67
68
68
69
1. Add the `docker-entrypoint.sh` and `healthcheck` files if needed.
69
70
70
71
1. Add any necessary `.conf` and `.ini` files for the service to the `etc` directory.
1. Once the build succeeds, test the changes by specifying the [Docker build sources].
79
+
1. After the build succeeds, test the changes by specifying the [Docker build sources].
77
80
78
81
## Add a new PHP extension
79
82
80
-
In addition to built-in extensions, you can add PHP extensions to the PHP container.
83
+
You can add PHP extensions to the PHP container by adding the extension configuration to the [ExtensionResolver.php] configuration file for {{ site.data.var.mcd-prod }}.
81
84
82
85
{:.procedure}
83
86
To add a new PHP extension:
84
87
85
-
1. Clone the `{{site.data.var.mcd}}` project to your local environment if necessary.
88
+
1. Clone the `{{site.data.var.mcd-package}}` project to your local environment.
86
89
87
90
1. On the command line, navigate to the PHP directory.
88
91
89
92
```bash
90
93
cd magento-cloud-docker/src/Compose/Php
94
+
```
91
95
92
-
1. Open the `ExtensionResolver.php` file, define the required extension inside the `getConfig` method by specifying the extension type and dependency.
96
+
1. Add one or more extensions to the `ExtensionResolver.php` file:
93
97
94
-
For instance the following block adds the GNUPG extension:
98
+
- Open the `ExtensionResolver.php` file for editing.
In this case, the `bcmath` PHP core extension installs from `docker-php-source` images.
116
+
117
+
{:.bs-callout-info}
118
+
The configuration you specify depends on the location of the extension source files and method of installation. You can add PHP core extensions from the official Docker PHP images, from the PECL repository, or using an installation script. For details on the configuration attributes and format for the `getConfig` method, see [PHP extension configuration reference](#php-extension-configuration-reference).
119
+
120
+
1. Enable the extension by default, or by adding it to the `.magento.app.yaml` file:
121
+
122
+
- To enable an extension by default, add it to the `DEFAULT_PHP_EXTENSIONS` array in the `ExtensionResolver.php` file.
123
+
124
+
```php?start_inline=1
125
+
126
+
/**
127
+
* Extensions which should be installed by default
128
+
*/
129
+
public const DEFAULT_PHP_EXTENSIONS = [
130
+
'bcmath',
131
+
'bz2',
132
+
'calendar',
133
+
'exif',
134
+
'gd',
135
+
'gettext',
136
+
'intl',
137
+
'mysqli',
138
+
'pcntl',
139
+
'pdo_mysql',
140
+
'soap',
141
+
'sockets',
142
+
'sysvmsg',
143
+
'sysvsem',
144
+
'sysvshm',
145
+
'opcache',
146
+
'zip',
147
+
];
148
+
```
149
+
150
+
- If you add the extension to the `.magento.app.yaml` for your Cloud project, you must regenerate the Docker compose configuration file and restart the Docker container.
105
151
106
152
1. Add any required `.ini` files to the PHP FPM container configuration.
107
153
108
-
- On the command line, navigate to FPM image directory `magento-cloud-docker/images/php/fpm`:
154
+
- On the command line, navigate to the FPM image directory `magento-cloud-docker/images/php/fpm`:
109
155
110
156
```bash
111
157
cd ../../../images/php/fpm
@@ -131,9 +177,9 @@ To add a new PHP extension:
131
177
132
178
- For each `.ini` file that you add, you must add the following line to the `Dockerfile` (`magento-cloud-docker/images/php/cli/Dockerfile`):
Use the following attributes to specify the PHP extension configuration in the `getConfig` method located in the [ExtensionResolver.php] file. The configuration you specify depends on method of installation: from the official Docker PHP images, from the PECL repository, or using an installation script.
195
+
196
+
| Configuration option | Description
197
+
| -------------------- | ------------
198
+
| PHP version constraint | Specifies the extension versions to install. If different versions have different installation requirements, you must add the configuration for each version.
199
+
| `EXTENSION_TYPE_CORE` | Extension that can be installed from a `docker-php-source` images.
200
+
| `EXTENSION_TYPE_PECL` | Extensions that can be installed from the [PECL] repository.
201
+
| `EXTENSION_TYPE_INSTALLATION_SCRIPT` | For extensions that install using a command sequence.
202
+
| `EXTENSION_TYPE` | Specifies whether the extension installed from the Docker PHP images, the PECL repository, or using an installation script. Valid values: `EXTENSION_TYPE_CORE`, `EXTENSION_TYPE_PECL`, or `EXTENSION_TYPE_INSTALLATION_SCRIPT`<br>
203
+
`EXTENSION_OS_DEPENDENCIES`| For PHP core or PECL extensions, specifies Linux package dependencies. These packages install in the order listed before installing the extension.
204
+
`EXTENSION_CONFIGURE_OPTIONS`| For PHP core extensions, specifies any configuration options to apply when Docker configures the PHP extension using the `docker-php-ext-configure` command.
205
+
`EXTENSION_PACKAGE_NAME`| Specifies the extension package name. This value is used to generate the installation command.
206
+
`EXTENSION_INSTALLATION_SCRIPT`| For extension type `EXTENSION_TYPE_INSTALLATION_SCRIPT`, specifies the Bash script to install the extension.
207
+
208
+
{:.bs-callout-info}
209
+
For more information about extension types and extension installation, see _How to install more PHP extensions_ section of the [PHP, Docker Official Images] page in Docker Hub.
210
+
211
+
#### Example: Core extension configuration
212
+
213
+
The following example shows the configuration for adding the PHP core extension `gd` in the `ExtensionResolver.php` file.
0 commit comments