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
**Docker Image for Symfony 4.3+ Application** running on **Nginx + PHP_FPM** based on [PHP Official Image](https://hub.docker.com/_/php).
32
-
This image should be used as a **base** image for your Symfony Project, **and you shall extend and edit it according to your app needs.**
33
-
The Image utilizes docker's multistage builds to create multiple targets optimized for **production** and **development**.
31
+
**Docker Image for Symfony 4.3+ Application** running **Nginx + PHP FPM** based on [PHP](https://hub.docker.com/_/php) & [Nginx](https://hub.docker.com/_/nginx)**Alpine Official Images**.
34
32
33
+
This is a pre-configured template image for your Symfony Project, **and you shall extend and edit it according to your app requirements.**
34
+
The Image utilizes docker's multistage builds to create multiple targets optimized for **production** and **development**.
35
35
36
36
You should copy this repository`Dockerfile`, `docker` Directory, `Makefile`, and `.dockerignore` to your Symfony application repository and configure it to your needs.
37
37
38
38
### Main Points 📜
39
39
40
-
-**Production Image is a fully contained Image with source code and dependencies inside**, Development image is set up for mounting source code on runtime with hot-reload.
40
+
-**Production Images is a fully contained Image with source code and dependencies inside**, Development image is set up for mounting source code on runtime with hot-reload.
41
41
42
-
- Image configuration is transparent, you can view and modify any of the configurations that determine the behavior of the application.
42
+
- Image configuration is transparent, all configuration and default configurations that determine app behavior are present in the image directory.
43
43
44
44
- Nginx **HTTP**, **HTTPS**, and **HTTP2** are pre-configured, for **HTTPS** it uses self-signed certificate generated at build-time. For production you'll need to mount your own signed certificates to `/etc/nginx/ssl` amd overwrite defaults.
45
45
46
46
- Image tries to fail at build time as much as possible by running all sort of Checks.
47
47
48
-
- Dockerfile is arranged for optimize builds, so that changed won't invalidate cache as much as possible.
|`nginx`| The Webserver, serves static content and replay others requests `php-fpm`| 21 MB | Nginx Access and Error logs. |`nginx-prod`, `nginx-dev`|
55
-
|`fpm`| PHP_FPM, which will actually run the PHP Scripts for web requests. | 78 MB | PHP Application logs only. |`fpm-prod`, `fpm-dev`|
56
-
|`supervisor`| Contains supervisor and source-code, for your consumers. (config at `docker/conf/supervisor/`) | 120 MB | Stdout of all Commands. |`supervisor-prod`|
57
-
|`cron`| Loads crontab and your app source-code, for your cron commands. (config at `docker/conf/crontab`) | 78 MB | Stdout of all Crons. |`cron-prod`|
58
-
59
-
> All Images are **Alpine** based. Official PHP-Alpine-Cli image size is 79.4MB.
60
-
61
-
> Size stated above are calculated excluding source code and vendor directory.
48
+
- Dockerfile is arranged for optimize prod builds, so that changes won't invalidate cache as much as possible.
62
49
63
50
-----
64
51
@@ -71,27 +58,25 @@ You should copy this repository`Dockerfile`, `docker` Directory, `Makefile`, and
71
58
72
59
# Setup
73
60
74
-
### Get Template
75
-
#### 1. Generate Repo from this Template
61
+
#### 1. Add Template to your repo.
76
62
77
63
1. Download This Repository
78
64
2. Copy `Dockerfile`, `docker` Directory, `Makefile`, and `.dockerignore` Into your Symfony Application Repository.
79
-
3. Modify `Dockerfile` to your app needs, and add your app needed PHP Extensions and Required Packages.
80
-
4. Situational:
81
-
- If you will use `Makefile` and `Docker-Compose`: go to `docker/.composer/.env` and modify `SERVER_NAME` to your app's name.
82
-
- If you will expose SSL port to Production: Mount your signed certificates `server.crt` & `server.key` to `/etc/nginx/ssl`.
83
-
Also make sure `SERVER_NAME` build ARG matches Certificate's **Common Name**.
84
-
5. run `make up` for development or `make deploy` for production.
<imgsrc="https://user-images.githubusercontent.com/16992394/65464461-20c95880-de5a-11e9-9bf0-fc79d125b99e.png"alt="create repository from template"></a>
90
70
91
-
<p> <small>And start from step 3..</small> </p>
71
+
#### 2. Start
72
+
1. Modify `Dockerfile` to your app needs, and add your app needed PHP Extensions and Required Packages.
73
+
2. Go to `docker/.composer/.env` and modify `SERVER_NAME` to your app's name.
74
+
3. Run `make up` for development or `make deploy` for production.
75
+
76
+
> Makefile is just a wrapper over docker-compose commands.
92
77
93
78
94
-
# Building Image
79
+
# Building and Extending Image
95
80
96
81
1. The image is to be used as a base for your Symfony application image, you should modify its Dockerfile to your needs.
97
82
@@ -114,6 +99,19 @@ However in an environment where CI/CD pipelines will build the image, they will
114
99
|`APP_ENV`| App Environment | - `prod` for Production image</br> - `dev` for Development image |
115
100
|`APP_DEBUG`| Enable Debug | - `0` for Production image</br>- `1` for Development image |
|`nginx`| The Webserver, serves static content and replay others requests `php-fpm`| 21 MB | Nginx Access and Error logs. |`nginx-prod`, `nginx-dev`|
107
+
|`fpm`| PHP_FPM, which will actually run the PHP Scripts for web requests. | 78 MB | PHP Application logs only. |`fpm-prod`, `fpm-dev`|
108
+
|`supervisor`| Contains supervisor and source-code, for your consumers. (config at `docker/conf/supervisor/`) | 120 MB | Stdout of all Commands. |`supervisor-prod`|
109
+
|`cron`| Loads crontab and your app source-code, for your cron commands. (config at `docker/conf/crontab`) | 78 MB | Stdout of all Crons. |`cron-prod`|
110
+
111
+
> All Images are **Alpine** based. Official PHP-Alpine-Cli image size is 79.4MB.
112
+
113
+
> Size stated above are calculated excluding source code and vendor directory.
114
+
117
115
## Tips for building Image in different environments
118
116
119
117
### Production
@@ -128,7 +126,6 @@ However in an environment where CI/CD pipelines will build the image, they will
128
126
129
127
----
130
128
131
-
132
129
# Configuration
133
130
134
131
## 1. PHP Extensions, Dependencies, and Configuration
0 commit comments