Skip to content

Commit 4672d26

Browse files
maxheliasdunglas
andauthored
docs: add all options available with env var (#598)
* docs: add all options available with env var * Update docs/options.md Co-authored-by: Kévin Dunglas <kevin@dunglas.fr> * Update docs/options.md --------- Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
1 parent d0df31e commit 4672d26

File tree

3 files changed

+72
-50
lines changed

3 files changed

+72
-50
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ with [FrankenPHP](https://frankenphp.dev) and [Caddy](https://caddyserver.com/)
3030

3131
## Docs
3232

33-
1. [Build options](docs/build.md)
33+
1. [Options available](docs/options.md)
3434
2. [Using Symfony Docker with an existing project](docs/existing-project.md)
3535
3. [Support for extra services](docs/extra-services.md)
3636
4. [Deploying in production](docs/production.md)

docs/build.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

docs/options.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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

Comments
 (0)