All Projects → kibatic → symfony-docker

kibatic / symfony-docker

Licence: other
🐳 Docker for Symfony application

Programming Languages

Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to symfony-docker

opensalt
Standards Alignment Tool
Stars: ✭ 39 (-2.5%)
Mutual labels:  symfony-docker
symfony-docker
This is a complete stack for running Symfony 6 with PHP-FPM 8.1 and MySQL 8 into Docker containers using docker-compose tool.
Stars: ✭ 172 (+330%)
Mutual labels:  symfony-docker
symfony-docker
A template for new Symfony applications using Docker: ./install.sh && 🚀
Stars: ✭ 34 (-15%)
Mutual labels:  symfony-docker

symfony-docker

Symfony + Nginx + php-fpm

Build Status

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

Supported tags and respective Dockerfile links

Image tags follows PHP versions

latest 8.1 (8.1/Dockerfile)

8.0 (8.0/Dockerfile)

7 7.4 (7.4/Dockerfile)

7.3 (7.3/Dockerfile)

7.2 (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 ✔️ (not tested) ✔️ (not tested) ✔️ (not tested)
8.0 ✔️ (not tested) ✔️ (default) ✔️ (not tested)
7.4 ✔️ ✔️ (default)
7.3 ✔️ (not tested) ✔️ (not tested) ✔️ (default) ✔️ (not tested)
7.2 ✔️ (not tested) ✔️ ✔️ ✔️ (not tested)
7.1 ✔️ (not tested) ✔️ ✔️
7.0 ✔️ (not tested) ✔️ (not tested)
5.6 ✔️ (not tested) ✔️ (not tested)

Composer versions :

  • 8.0+ : 2.x
  • 7.4 : 2.x
  • 7.3 : 1.10.17
  • 7.2 : 1.10.17

Usage

docker pull kibatic/symfony

Then run in your symfony folder

# 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.

COPY nginx.conf /etc/nginx/sites-enabled/default

You may also want to add only some directives in existing site config.

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.

# 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 :

This image setup a known workaround (see here) 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

# 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

We also provide a default dirty solution for standard monolog configuration, this is not recommended in production

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].