|
| 1 | +# Docker Build Options |
| 2 | + |
| 3 | +You can customize the docker build process using these environment variables. |
| 4 | + |
| 5 | +> [!NOTE] |
| 6 | +> All Symfony-specific environment variables are used only if no `composer.json` file is found in the project directory. |
| 7 | +
|
| 8 | +## Selecting a Specific Symfony Version |
| 9 | + |
| 10 | +Use the `SYMFONY_VERSION` environment variable to select a specific Symfony version. |
| 11 | + |
| 12 | +For instance, use the following command to install Symfony 6.4: |
| 13 | + |
| 14 | +On Linux: |
| 15 | + |
| 16 | + SYMFONY_VERSION=6.4.* docker compose up -d --wait |
| 17 | +On Windows: |
| 18 | + |
| 19 | + set SYMFONY_VERSION=6.4.* && docker compose up -d --wait&set SYMFONY_VERSION= |
| 20 | + |
| 21 | +## Installing Development Versions of Symfony |
| 22 | + |
| 23 | +To install a non-stable version of Symfony, use the `STABILITY` environment variable during the build. |
| 24 | +The value must be [a valid Composer stability option](https://getcomposer.org/doc/04-schema.md#minimum-stability). |
| 25 | + |
| 26 | +For instance, use the following command to use the development branch of Symfony: |
| 27 | + |
| 28 | +On Linux: |
| 29 | + |
| 30 | + STABILITY=dev docker compose up -d --wait |
| 31 | + |
| 32 | +On Windows: |
| 33 | + |
| 34 | + set STABILITY=dev && docker compose up -d --wait&set STABILITY= |
| 35 | + |
| 36 | +## Using custom HTTP ports |
| 37 | + |
| 38 | +Use the environment variables `HTTP_PORT`, `HTTPS_PORT` and/or `HTTP3_PORT` to adjust the ports to your needs, e.g. |
| 39 | + |
| 40 | + HTTP_PORT=8000 HTTPS_PORT=4443 HTTP3_PORT=4443 docker compose up -d --wait |
| 41 | + |
| 42 | +to access your application on [https://localhost:4443](https://localhost:4443). |
| 43 | + |
| 44 | +> [!NOTE] |
| 45 | +> Let's Encrypt only supports the standard HTTP and HTTPS ports. Creating a Let's Encrypt certificate for another port will not work, you have to use the standard ports or to configure Caddy to use another provider. |
| 46 | +
|
| 47 | + |
| 48 | +## Caddyfile Options |
| 49 | + |
| 50 | +You can also customize the `Caddyfile` by using the following environment variables to inject options block, directive or configuration. |
| 51 | + |
| 52 | +> [!TIP] |
| 53 | +> All the following environment variables can be defined in your `.env` file at the root of the project to keep them persistent at each startup |
| 54 | +
|
| 55 | +| Environment variable | Description | Default value | |
| 56 | +|---------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------| |
| 57 | +| `CADDY_GLOBAL_OPTIONS` | the [global options block](https://caddyserver.com/docs/caddyfile/options#global-options), one per line | | |
| 58 | +| `CADDY_EXTRA_CONFIG` | the [snippet](https://caddyserver.com/docs/caddyfile/concepts#snippets) or the [named-routes](https://caddyserver.com/docs/caddyfile/concepts#named-routes) options block, one per line | | |
| 59 | +| `CADDY_SERVER_EXTRA_DIRECTIVES` | the [`Caddyfile` directives](https://caddyserver.com/docs/caddyfile/concepts#directives) | | |
| 60 | +| `SERVER_NAME` | the server name or address | `localhost` | |
| 61 | +| `FRANKENPHP_CONFIG` | a list of extra [FrankenPHP directives](https://frankenphp.dev/docs/config/#caddyfile-config), one per line | `import worker.Caddyfile` | |
| 62 | +| `MERCURE_TRANSPORT_URL` | the value passed to the `transport_url` directive | `bolt://mercure.db` | |
| 63 | +| `MERCURE_PUBLISHER_JWT_KEY` | the JWT key to use for publishers | | |
| 64 | +| `MERCURE_PUBLISHER_JWT_ALG` | the JWT algorithm to use for publishers | `HS256` | |
| 65 | +| `MERCURE_SUBSCRIBER_JWT_KEY` | the JWT key to use for subscribers | | |
| 66 | +| `MERCURE_SUBSCRIBER_JWT_ALG` | the JWT algorithm to use for subscribers | `HS256` | |
| 67 | +| `MERCURE_EXTRA_DIRECTIVES` | a list of extra [Mercure directives](https://mercure.rocks/docs/hub/config), one per line | | |
| 68 | + |
| 69 | +### Example of server name customize: |
| 70 | + |
| 71 | + SERVER_NAME="app.localhost" docker compose up -d --wait |
0 commit comments