Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kibatic/symfony-docker
Docker for Symfony application :whale:
https://github.com/kibatic/symfony-docker
docker nginx php php-7 php-fpm symfony symfony-docker
Last synced: about 1 month ago
JSON representation
Docker for Symfony application :whale:
- Host: GitHub
- URL: https://github.com/kibatic/symfony-docker
- Owner: kibatic
- Created: 2016-02-05T10:34:24.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-06-19T13:58:01.000Z (5 months ago)
- Last Synced: 2024-09-29T19:41:16.592Z (about 2 months ago)
- Topics: docker, nginx, php, php-7, php-fpm, symfony, symfony-docker
- Language: Dockerfile
- Homepage:
- Size: 208 KB
- Stars: 38
- Watchers: 8
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![symfony-docker](http://i.imgur.com/vc5ZVqL.png?2)
# Symfony + Nginx + php-fpm
[![Build Status](https://travis-ci.org/kibatic/symfony-docker.svg?branch=master)](https://travis-ci.org/kibatic/symfony-docker)
[![](https://images.microbadger.com/badges/image/kibatic/symfony:latest.svg)](https://microbadger.com/images/kibatic/symfony:latest "Get your own image badge on microbadger.com")
[![](https://images.microbadger.com/badges/version/kibatic/symfony:latest.svg)](https://microbadger.com/images/kibatic/symfony:latest "Get your own version badge on microbadger.com")Docker for Symfony application, powered by **Nginx** and **php-fpm**.
Based on Debian Jessie.
If you are experiencing some issues, take a look at [TROUBLESHOOTING](TROUBLESHOOTING.md)
### Supported tags and respective `Dockerfile` links
Image tags follows PHP versions
`latest` `8.1` [(8.1/Dockerfile)](https://github.com/kibatic/symfony-docker/blob/master/8.1/Dockerfile)
`8.0` [(8.0/Dockerfile)](https://github.com/kibatic/symfony-docker/blob/master/8.0/Dockerfile)
`7` `7.4` [(7.4/Dockerfile)](https://github.com/kibatic/symfony-docker/blob/master/7.4/Dockerfile)
`7.3` [(7.3/Dockerfile)](https://github.com/kibatic/symfony-docker/blob/master/7.3/Dockerfile)
`7.2` [(7.2/Dockerfile)](https://github.com/kibatic/symfony-docker/blob/master/7.2/Dockerfile)
`7.1` **Not maintained, END OF LIFE**
`7.0` **Not maintained, END OF LIFE**
`5`, `5.6` **Not maintained, END OF LIFE**
`5.4` **Not maintained, END OF LIFE**
### Compatibility matrix
Symfony
Image
2.x
3.x
4.x
5.x
6.x
8.1
:x:
:x:
:heavy_check_mark: (not tested)
:heavy_check_mark: (not tested)
:heavy_check_mark: (not tested)
8.0
:x:
:x:
:heavy_check_mark: (not tested)
:heavy_check_mark: (default)
:heavy_check_mark: (not tested)
7.4
:x:
:x:
:heavy_check_mark:
:heavy_check_mark: (default)
:x:
7.3
:heavy_check_mark: (not tested)
:heavy_check_mark: (not tested)
:heavy_check_mark: (default)
:heavy_check_mark: (not tested)
:x:
7.2
:heavy_check_mark: (not tested)
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark: (not tested)
:x:
7.1
:heavy_check_mark: (not tested)
:heavy_check_mark:
:heavy_check_mark:
:x:
:x:
7.0
:heavy_check_mark: (not tested)
:heavy_check_mark: (not tested)
:x:
:x:
:x:
5.6
:heavy_check_mark: (not tested)
:heavy_check_mark: (not tested)
:x:
:x:
:x:
Composer versions :
- 8.0+ : 2.x
- 7.4 : 2.x
- 7.3 : 1.10.17
- 7.2 : 1.10.17### Usage
```bash
docker pull kibatic/symfony
```Then run in your symfony folder
```bash
# Image >= 7.3 & Symfony 2.x, 3.x
docker run -e SYMFONY_VERSION=3 -v $(pwd):/var/www -p 8080:80 kibatic/symfony:7.3# Image >= 7.3 & Symfony 4.x
docker run -v $(pwd):/var/www -p 8080:80 kibatic/symfony:7.3# Image < 7.3 & Symfony 2.x, 3.x
docker run -v $(pwd):/var/www -p 8080:80 kibatic/symfony:7.2# Image < 7.3 & Symfony 4.x
docker run -e SYMFONY_VERSION=4 -v $(pwd):/var/www -p 8080:80 kibatic/symfony:7.2
```Symfony app will be accessible on http://localhost:8080/
### Custom nginx configuration
If you want to replace the default nginx settings, overwrite configuration file at `/etc/nginx/sites-enabled/default`.
```dockerfile
COPY nginx.conf /etc/nginx/sites-enabled/default
```You may also want to add only some directives in [existing site config](7.4/rootfs/etc/nginx/sites-enabled/default#L5).
```dockerfile
COPY custom-config.conf /etc/nginx/conf.d/docker/custom-config.conf
```### Logging (PHP >= 7.3)
For both production and dev environment you should log to stdout / stderr, example below.
```yaml
# config/packages/monolog.yaml
monolog:
handlers:
stdout:
type: stream
path: 'php://stdout'
level: debug
channels: ['!event']
# (Optional) format logs to json
#formatter: monolog.formatter.json
stderr:
type: stream
path: 'php://stderr'
level: error
# (Optional) format logs to json
#formatter: monolog.formatter.json
```### Logging (PHP < 7.3)
A common practice is to log to stdout, but there are major bug in php-fpm wich makes stdout logging not reliable :
* Logs are truncated when message length exceed 1024 https://bugs.php.net/bug.php?id=69031
* FPM prepend a warning string to worker output https://bugs.php.net/bug.php?id=71880This image setup a known workaround ([see here](https://github.com/docker-library/php/issues/207)) and expose a log stream as env var **LOG_STREAM**, but **you cannot log to stdout**
For a proper logging you have to configure monolog to log to this stream```yaml
# app/config_dev.yml
monolog:
handlers:
main:
type: stream
path: '/tmp/stdout'
level: debug
```You can also use symfony `%env(LOG_STREAM)%` if your symfony version is compatible with [this syntax](https://symfony.com/doc/3.4/configuration/external_parameters.html)
We also provide a default dirty solution for standard monolog configuration, **this is not recommended in production**
```bash
tail -q -n 0 -F app/logs/dev.log app/logs/prod.log var/logs/dev.log var/logs/prod.log
```### Minimal package included
* nginx
* php\*-fpm
* php\*-cli
* php\*-intl
* php\*-mbstring### Exposed port
* 80 : nginx