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
doc: add information about building production image (#752)
* Add information about building production image
* add informations about deploying in production
* Fix typo
* Remove logs
* Maintain common command format
Co-authored-by: Stanislau Kviatkouski <7-zete-7@users.noreply.github.com>
* Add link about how Docker Compose config file merge works
Co-authored-by: Stanislau Kviatkouski <7-zete-7@users.noreply.github.com>
* Maintain common command format
Co-authored-by: Stanislau Kviatkouski <7-zete-7@users.noreply.github.com>
* Maintain common command format
Co-authored-by: Maxime Helias <maximehelias16@gmail.com>
* Fix to build command
Co-authored-by: Stanislau Kviatkouski <7-zete-7@users.noreply.github.com>
---------
Co-authored-by: Stanislau Kviatkouski <7-zete-7@users.noreply.github.com>
Co-authored-by: Maxime Helias <maximehelias16@gmail.com>
Both dev and prod images have the same image tag (`<...>app-php:latest`). This can cause confusion when working with images.
27
+
It is important to make sure that your image is the appropriate one for the current environment.
28
+
29
+
If you are not careful about this, and try to run your production container(s) with
30
+
`docker compose -f compose.yaml -f compose.prod.yaml up -d`
31
+
without the right build process beforehand, your application **will still launch**, but will be displaying an output of `phpinfo()` (or possibly even a HTTP 500 error page).
32
+
33
+
See details below.
34
+
35
+
<details>
36
+
37
+
<summary>Output of a basic build process</summary>
38
+
39
+
In the case of a dev image, you need the `compose.yaml` and `compose.override.yaml` files. Which are the default files for Docker Compose.
40
+
This means that running `docker compose <command>` or `docker compose -f compose.yaml -f compose.override.yaml <command>` is the same thing.
41
+
42
+
And in doing so, images `frankenphp_base` and `frankenphp_dev` are built. And not `frankenphp_prod`.
43
+
Which is good enough for dev purposes.
44
+
45
+
Then, you can start your dev container(s) by running:
46
+
47
+
```console
48
+
docker compose up -d
49
+
```
50
+
51
+
52
+
</details>
53
+
54
+
<br>
55
+
56
+
<details>
57
+
58
+
<summary>Output expected for the production build process</summary>
59
+
60
+
To build the production image, you <ins>have to</ins> specify the `compose.yaml` and `compose.prod.yaml` files.
61
+
This means you have to run: `docker compose -f compose.yaml -f compose.prod.yaml build` in order to build your image
62
+
(careful: the order of `-f` arguments is important).
63
+
64
+
That way, you will see that `frankenphp_base` and `frankenphp_prod` are built this time, which is what you will need for production purposes.
65
+
66
+
You can finally start your prod container(s) by running:
67
+
68
+
```console
69
+
docker compose -f compose.yaml -f compose.prod.yaml up -d
0 commit comments