Projekt

Obecné

Profil

« Předchozí | Další » 

Revize b332d98a

Přidáno uživatelem Tomáš Ballák před asi 4 roky(ů)

Re #7986 devops refactor

Zobrazit rozdíly:

.docker-compose-dev.yml
1
version: "3.2"
2
services:
3
       py-charm:
4
                build:
5
                        context: ./python-module
6
                        dockerfile: '../build/php-fpm/dev/Dockerfile'
7
                ports: 
8
                        - "9001:9000"
9
                volumes: 
10
                        - ./python-module:/var/python-module
11
 
12
                container_name: "heatmap_py_charm"
13
       php-fpm:
14
               build: ./build/php-fpm/dev/
15
               depends_on: 
16
                       - database
17
               networks:
18
                   - backend
19
               ports: 
20
                       - "9000:9000"
21
               volumes:
22
                       - ./website/:/var/www/symfony
23
                       - ./python-module:/var/python-module
24
               container_name: "heatmap_php_fpm"
25
               environment:
26
                       XDEBUG_CONFIG: remote_host=172.17.0.1 #your docker network i TODO:NOT WORKING
27
       nginx:
28
               build: './build/nginx'
29
               depends_on:
30
                       - php-fpm
31
                       - database
32
               networks:
33
                       - frontend
34
                       - backend
35
               ports:
36
                       - "80:80"
37
               volumes:
38
                       - ./logs/nginx:/var/log/nginx
39
                       - ./website/:/var/www/symfony
40
               container_name: "heatmap_nginx"
41
       database:
42
               image: 'mongo'
43
               container_name: "heatmap_mongodb"
44
               restart: always
45
               networks:
46
                       - backend
47
               ports:
48
                       - '27017-27019:27017-27019'
49
              
50
               environment:
51
                       MONGO_INITDB_DATABASE: open-data-db
52
                       MONGO_INITDB_ROOT_USERNAME: root
53
                       MONGO_INITDB_ROOT_PASSWORD: root
54
               volumes:
55
                        - data-db:/data/db
56
                        - ./dev-dump:/dev-dump
57
                        
58
volumes:
59
    data-db:
60
    
61
networks:
62
       frontend:
63
       backend:
.gitignore
3 3
.idea
4 4
dev-dump
5 5
*.lock
6
.vscode-server
.vscode/extensions.json
1
{
2
    "recommendations": [
3
        "ms-vscode-remote.remote-containers"
4
    ]
5

  
6
}
README.md
24 24
* First you need to set python interpeter to the containers by **following these steps**
25 25
<div style="display: flex; flex-direction: row; justify-content: space-around;flex-wrap: wrap">
26 26
  <div style="height: 450px; display: flex; justify-content: space-between;flex-direction: column;">
27
  <img src="./guide/1.png" width="500px" style="display: block"/>
27
  <img src="./doc/images/1.png" width="500px" style="display: block"/>
28 28
  <p style="background: red">A. Enter Settings (File/Preferences/Settings)</p>
29 29
  </div>
30 30
  <div style="height: 450px; display: flex; justify-content: space-between; flex-direction: column;">
31
  <img src="./guide/2.png" width="500px" height="360px" style="display: block"/>
31
  <img src="./doc/images/2.png" width="500px" height="360px" style="display: block"/>
32 32
  <p style="background: red">B. In the left panel choose <b>Docker</b> and in <b>Image Name</b> choose <b>heatmap_py-charm</b></p>
33 33
  </div>
34 34
  <div style="height: 450px; display: flex; justify-content: space-between;flex-direction: column;">
35
  <img src="./guide/3.png" width="500px" style="display: block"/>
35
  <img src="./doc/images/3.png" width="500px" style="display: block"/>
36 36
  <p style="background: red">C. When setup is ok you will see all packages from requirements on this screen</b></p>
37 37
  </div>
38 38
</div>
build/nginx/Dockerfile
1
FROM nginx:alpine
2
COPY nginx.conf /etc/nginx
3
COPY conf.d /etc/nginx/conf.d
4
ADD ./sites /etc/nginx/sites-available
5
WORKDIR /var/www/
6
CMD ["nginx"]
build/nginx/conf.d/default.conf
1
upstream php-upstream {
2
    server php-fpm:9000;
3
}
build/nginx/nginx.conf
1
user  nginx;
2
worker_processes  4;
3
daemon off;
4

  
5
error_log  /var/log/nginx/error.log warn;
6
pid        /var/run/nginx.pid;
7

  
8
events {
9
    worker_connections  1024;
10
}
11

  
12

  
13
http {
14
    include       /etc/nginx/mime.types;
15
    default_type  application/octet-stream;
16
    access_log  /var/log/nginx/access.log;
17
    sendfile        on;
18
    keepalive_timeout  65;
19

  
20
    include /etc/nginx/conf.d/*.conf;
21
    include /etc/nginx/sites-available/*.conf;
22
}
build/nginx/sites/default.conf
1
server {
2
    listen 80 default_server;
3
    listen [::]:80 default_server ipv6only=on;
4

  
5
    server_name localhost;
6
    root /var/www/symfony/public;
7
    index index.php index.html index.htm;
8

  
9
    location / {
10
         try_files $uri $uri/ /index.php$is_args$args;
11
    }
12

  
13
    location ~ \.php$ {
14
        try_files $uri /index.php =404;
15
        fastcgi_pass php-upstream;
16
        fastcgi_index index.php;
17
        fastcgi_buffers 16 16k;
18
        fastcgi_buffer_size 32k;
19
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
20
        fastcgi_read_timeout 600;
21
        include fastcgi_params;
22
    }
23

  
24
    location ~ /\.ht {
25
        deny all;
26
    }
27
}
build/php-fpm/Dockerfile
1
FROM php:7.4-fpm-alpine
2
RUN apk update; \
3
	apk upgrade; \
4
	apk add autoconf openssl-dev g++ make && \
5
    echo "**** install MongoDB ****\n" && \
6
	pecl install mongodb && \
7
	docker-php-ext-enable mongodb; \
8
	apk del --purge autoconf openssl-dev g++ make;
9
RUN echo "**** install Python ****\n" && \
10
    apk add --no-cache python3 && \
11
    if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi && \
12
    \
13
    echo "**** install pip ****\n" && \
14
    python3 -m ensurepip && \
15
    rm -r /usr/lib/python*/ensurepip && \
16
    pip3 install --no-cache --upgrade pip setuptools wheel && \
17
    if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi
18
RUN echo "**** install PHP Composer ****\n" && \
19
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
build/php-fpm/dev/Dockerfile
1
#DEV ONLY DOCKERFILE
2
FROM php:7.4-fpm-alpine
3
RUN apk update; \
4
	apk upgrade; \
5
	apk add autoconf openssl-dev g++ make && \
6
	pecl install mongodb && \
7
	docker-php-ext-enable mongodb; \
8
	apk del --purge autoconf openssl-dev g++ make;
9

  
10
RUN echo "**** install Python ****" && \
11
    apk add --no-cache python3 && \
12
    if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi && \
13
    \
14
    echo "**** install pip ****" && \
15
    python3 -m ensurepip && \
16
    rm -r /usr/lib/python*/ensurepip && \
17
    pip3 install --no-cache --upgrade pip setuptools wheel && \
18
    if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi
19
RUN echo "**** install PHP Composer ****\n" && \
20
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
21
COPY requirements.txt /requirements.txt
22
RUN pip install -r /requirements.txt
build/php-fpm/dev/xdebug.ini
1
[XDebug]
2
xdebug.remote_enable=1
3
xdebug.remote_autostart=1
4
xdebug.remote_handler=dbgp
5
xdebug.remote_port=9000
6
xdebug.remote_connect_back=0
docker-compose-dev.yml
1
version: "3.2"
2
services:
3
       php-fpm:
4
               build: './docker/php-fpm/dev'
5
               volumes:
6
                        - vscode-extensions-php:/var/www/symfony/.vscode-server/extensions
7
                        - ./logs/xdebug:/var/www/symfony/xdebug
8
       crawler:
9
               volumes: 
10
                        - vscode-extensions-crawler:/src/.vscode-server/extensions
11
       database:
12
               volumes:
13
                        - data-db:/data/db
14
                        - ./dev-dump:/dev-dump
15
volumes:
16
    data-db:
17
    vscode-extensions-php:
18
    vscode-extensions-crawler:
docker-compose-prod.yml
1
version: "3.2"
2
services:
3
       database:
4
               volumes:
5
                        - /database:/data/db
docker-compose.yml
1 1
version: "3.2"
2 2
services:
3
       crawler:
4
                build: 
5
                        context: ./modules/crawler
6
                        dockerfile: ../../docker/crawler/Dockerfile
7

  
8
                depends_on: 
9
                        - database
10
                networks:
11
                        - backend
12
                volumes:
13
                        - ./modules/crawler/:/src
14
                        - ./logs/crawler:/log/
15
                container_name: "heatmap_crawler"
16
                
3 17
       php-fpm:
4
               build: './build/php-fpm'
18
               build: './docker/php-fpm'
5 19
               depends_on: 
6 20
                       - database
7 21
               networks:
......
10 24
                       - "9000:9000"
11 25
               volumes:
12 26
                       - ./website/:/var/www/symfony
13
                       - ./python-module:/var/python-module
14 27

  
15 28
               container_name: "heatmap_php_fpm"
16 29
       nginx:
17
               build: './build/nginx'
30
               build: './docker/nginx'
18 31
               depends_on:
19 32
                       - php-fpm
20 33
                       - database
34
                       - crawler
21 35
               networks:
22 36
                       - frontend
23 37
                       - backend
24 38
               ports:
25 39
                       - "80:80"
26 40
               volumes:
27
                       - ./logs:/var/nginx/log
41
                       - ./logs/nginx:/var/nginx/log
28 42
                       - ./website/:/var/www/symfony
29 43
               container_name: "heatmap_nginx"
30 44
       database:
......
39 53
                       MONGO_INITDB_DATABASE: open-data-db
40 54
                       MONGO_INITDB_ROOT_USERNAME: root
41 55
                       MONGO_INITDB_ROOT_PASSWORD: root
42
               volumes:
43
                        - /database:/data/db
44 56
networks:
45 57
       frontend:
46 58
       backend:
docker/crawler/Dockerfile
1
FROM python:3-slim
2

  
3
RUN apt-get update && apt-get install -y cron
4
RUN yes | apt-get install software-properties-common
5
RUN apt-get install dialog apt-utils -y
6
RUN pip install -q --no-cache-dir --upgrade pip
7
ADD crontab /etc/cron.d/simple-cron
8
RUN chmod 0644 /etc/cron.d/simple-cron
9
RUN crontab /etc/cron.d/simple-cron
10

  
11
ADD requirements.txt /requirements.txt
12
RUN pip install -r /requirements.txt
13
CMD cron -f
docker/nginx/Dockerfile
1
FROM nginx:alpine
2
COPY nginx.conf /etc/nginx
3
COPY conf.d /etc/nginx/conf.d
4
ADD ./sites /etc/nginx/sites-available
5
WORKDIR /var/www/
6
CMD ["nginx"]
docker/nginx/conf.d/default.conf
1
upstream php-upstream {
2
    server php-fpm:9000;
3
}
docker/nginx/nginx.conf
1
user  nginx;
2
worker_processes  4;
3
daemon off;
4

  
5
error_log  /var/log/nginx/error.log warn;
6
pid        /var/run/nginx.pid;
7

  
8
events {
9
    worker_connections  1024;
10
}
11

  
12

  
13
http {
14
    include       /etc/nginx/mime.types;
15
    default_type  application/octet-stream;
16
    access_log  /var/log/nginx/access.log;
17
    sendfile        on;
18
    keepalive_timeout  65;
19

  
20
    include /etc/nginx/conf.d/*.conf;
21
    include /etc/nginx/sites-available/*.conf;
22
}
docker/nginx/sites/default.conf
1
server {
2
    listen 80 default_server;
3
    listen [::]:80 default_server ipv6only=on;
4

  
5
    server_name localhost;
6
    root /var/www/symfony/public;
7
    index index.php index.html index.htm;
8

  
9
    location / {
10
         try_files $uri $uri/ /index.php$is_args$args;
11
    }
12

  
13
    location ~ \.php$ {
14
        try_files $uri /index.php =404;
15
        fastcgi_pass php-upstream;
16
        fastcgi_index index.php;
17
        fastcgi_buffers 16 16k;
18
        fastcgi_buffer_size 32k;
19
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
20
        fastcgi_read_timeout 600;
21
        include fastcgi_params;
22
    }
23

  
24
    location ~ /\.ht {
25
        deny all;
26
    }
27
}
docker/php-fpm/Dockerfile
1
FROM php:7.4-fpm-alpine
2
RUN apk update; \
3
	apk upgrade; \
4
	apk add autoconf openssl-dev g++ make && \
5
    echo "**** install MongoDB ****\n" && \
6
	pecl install mongodb && \
7
	docker-php-ext-enable mongodb; \
8
	apk del --purge autoconf openssl-dev g++ make;
9
RUN echo "**** install Python ****\n" && \
10
    apk add --no-cache python3 && \
11
    if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi && \
12
    \
13
    echo "**** install pip ****\n" && \
14
    python3 -m ensurepip && \
15
    rm -r /usr/lib/python*/ensurepip && \
16
    pip3 install --no-cache --upgrade pip setuptools wheel && \
17
    if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi
18
RUN echo "**** install PHP Composer ****\n" && \
19
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
docker/php-fpm/dev/Dockerfile
1
#DEV ONLY DOCKERFILE
2
FROM php:7.4-fpm-alpine
3
RUN apk update; \
4
	apk upgrade; \
5
    apk add --no-cache $PHPIZE_DEPS \
6
    && pecl install xdebug-2.9.5 \
7
    && docker-php-ext-enable xdebug \
8
	apk add autoconf openssl-dev g++ make && \
9
	pecl install mongodb && \
10
	docker-php-ext-enable mongodb; \
11
	apk del --purge autoconf openssl-dev g++ make;
12
RUN echo "**** install PHP Composer ****\n" && \
13
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
14
RUN rm -rf /usr/local/etc/php/conf.d/docker-php-ext-igbinary.ini;
15
RUN rm -fr /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini;
16
RUN { \
17
        echo '[xdebug]'; \
18
        echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)"; \
19
        echo 'xdebug.remote_enable = 1'; \
20
        echo 'xdebug.remote_port = 9001'; \
21
        echo 'xdebug.remote_autostart = 1'; \
22
        echo 'xdebug.remote_connect_back = 0'; \
23
        echo 'xdebug.remote_host = localhost'; \
24
        echo 'xdebug.idekey = VSCODE'; \
25
        echo 'xdebug.remote_log=/var/www/symfony/xdebug/xdebug.log'; \
26
    } > /usr/local/etc/php/conf.d/php-config.ini
docker/php-fpm/dev/xdebug.ini
1
[XDebug]
2
xdebug.remote_enable=1
3
xdebug.remote_autostart=1
4
xdebug.remote_port=9001
5
xdebug.remote_connect_back=1
modules/crawler/.devcontainer/devcontainer.json
1
{
2
    "forwardPorts": [
3
        8000
4
    ],
5
    "extensions": [
6
        "vscode-icons-team.vscode-icons",
7
        "ms-python.python",
8
        "njpwerner.autodocstring",
9
        "magicstack.magicpython"
10
    ],
11
    "workspaceFolder": "/src",
12
    "service": "crawler",
13
    "shutdownAction": "stopCompose",
14
    "dockerComposeFile": [
15
        "../../../docker-compose.yml",
16
        "../../../docker-compose-dev.yml"
17
    ],
18
    "mounts": [
19
        "source=vscode-extensions-python,target=/src/.vscode-server/extensions,type=volume"
20
    ]
21
}
modules/crawler/crontab
1
0 1 * * * echo test
2
# Mandatory blank line
modules/crawler/python.code-workspace
1
{
2
	"folders": [
3
		{
4
			"path": "."
5
		}
6
	],
7
	"settings": {
8
		"php.suggest.basic": false,
9
		"files.autoSave": "afterDelay",
10
		"editor.formatOnSave": true,
11
		"python.linting.pylintEnabled": true,
12
		"python.linting.enabled": true,
13
		"python.linting.pylintPath": "pylint",
14
		"python.pythonPath": "/usr/local/bin/python",
15
		"python.formatting.provider": "yapf",
16
	},
17
	"extensions": {
18
		"recommendations": [
19
			"vscode-icons-team.vscode-icons",
20
			"ms-python.python",
21
			"njpwerner.autodocstring",
22
			"magicstack.magicpython",
23
			"ms-vscode-remote.remote-containers"
24
		]
25
	}
26
}
modules/crawler/requirements.txt
1
emoji===0.5.4
2
pylint===2.4.4
3
yapf===0.30.0
modules/crawler/test.py
1
import emoji
2
print(emoji.emojize("Python is :thumbs_up:"))
3
print("test")
python-module/requirements.txt
1
 emoji===0.5.4
python-module/test.py
1
import emoji
2
print(emoji.emojize('Python is :thumbs_up:'))
scripts/build.sh
1 1
#!/bin/bash
2
#Build development environment
3 2
docker-compose down
4
docker-compose up --build -d
5
docker-compose exec -T php-fpm composer install --no-interaction --working-dir=/var/www/symfony --no-dev
6
docker-compose exec -T php-fpm pip install -r /var/python-module/requirements.txt
3
docker-compose -f docker-compose.yml -f docker-compose-prod.yml up --build -d
4
docker-compose exec -T php-fpm composer install --no-interaction --working-dir=/var/www/symfony --no-dev
scripts/dev/build.bat
1
docker-compose down --remove-orphans
2
docker-compose -f .docker-compose-dev.yml up --build -d
1
docker-compose -f docker-compose.yml -f docker-compose-dev.yml up --build -d
3 2
docker-compose exec php-fpm composer config extra.symfony.allow-contrib true --no-interaction --working-dir=/var/www/symfony
4 3
docker-compose exec php-fpm composer install --no-interaction --working-dir=/var/www/symfony
5 4
docker-compose exec php-fpm composer update --no-interaction --working-dir=/var/www/symfony
6

  
scripts/dev/build.sh
1 1
#!/bin/bash
2 2
#Build development environment
3
docker-compose down --remove-orphans
4
docker-compose -f .docker-compose-dev.yml up --build -d
3
docker-compose -f docker-compose.yml -f docker-compose-dev.yml up --build -d
5 4

  
6 5
cat << "EOF"
7 6
 ______  ______  __    __  ______ ______  ______  ______  ______       __  __   __  ______  ______ ______  __      __        
......
10 9
 \ \_____\ \_____\ \_\ \ \_\ \_\  \ \_____\/\_____\ \_____\ \_\ \_\    \ \_\ \_\\"\_\/\_____\ \ \_\\ \_\ \_\ \_____\ \_____\ 
11 10
  \/_____/\/_____/\/_/  \/_/\/_/   \/_____/\/_____/\/_____/\/_/ /_/     \/_/\/_/ \/_/\/_____/  \/_/ \/_/\/_/\/_____/\/_____/                                                                                                                                                                                                                                                                                                                                                                                                                                      
12 11
EOF
12
docker-compose exec php-fpm composer config extra.symfony.allow-contrib true --no-interaction --working-dir=/var/www/symfony
13
docker-compose exec php-fpm composer update --no-interaction --working-dir=/var/www/symfony
13 14
docker-compose exec php-fpm composer install --no-interaction --working-dir=/var/www/symfony
14
cat << "EOF"
15
 ______  __   ______     __   __   __   ______   ______  ______   __       __        
16
/\  == \/\ \ /\  == \   /\ \ /\ "-.\ \ /\  ___\ /\__  _\/\  __ \ /\ \     /\ \       
17
\ \  _-/\ \ \\ \  _-/   \ \ \\ \ \-.  \\ \___  \\/_/\ \/\ \  __ \\ \ \____\ \ \____  
18
 \ \_\   \ \_\\ \_\      \ \_\\ \_\\"\_\\/\_____\  \ \_\ \ \_\ \_\\ \_____\\ \_____\ 
19
  \/_/    \/_/ \/_/       \/_/ \/_/ \/_/ \/_____/   \/_/  \/_/\/_/ \/_____/ \/_____/                                                                                                                                                                                     
20
EOF
21
docker-compose exec php-fpm pip install -r /var/python-module/requirements.txt
scripts/dev/pip.bat
1
docker-compose exec -T php-fpm pip install -r /var/python/requirements.txt
1
docker-compose exec -T crawler pip install -r /var/python/requirements.txt
scripts/pip.sh
1
#install requirements pips.sh install -r /var/python/requirements.txt
2
docker-compose exec -T php-fpm pip $@
1
#!/bin/bash
2
#install requirements pip.sh install -r /var/python/requirements.txt
3
docker-compose exec -T crawler pip $@
scripts/restore_db.sh
1
#!/bin/bash
2
docker-compose exec -T database mongorestore --username root --password root --authenticationDatabase admin --db open-data-db /dev-dump/data
website/.devcontainer/devcontainer.json
1
{
2
    "forwardPorts": [8000],
3
    "extensions": [
4
        "vscode-icons-team.vscode-icons",
5
        "felixfbecker.php-intellisense",
6
        "whatwedo.twig",
7
        "felixfbecker.php-debug",
8
        "junstyle.php-cs-fixer"
9
    ],
10
    "workspaceFolder": "/var/www/symfony",
11
    "service": "php-fpm",
12
    "dockerComposeFile": ["../../docker-compose.yml", "../../docker-compose-dev.yml"],
13
    "mounts":["source=vscode-extensions-php,target=/var/www/symfony/.vscode-server/extensions,type=volume"]
14

  
15
}
website/.gitignore
7 7
/public/bundles/
8 8
/var/
9 9
/vendor/
10
.php_cs.cache
10 11
###< symfony/framework-bundle ###
11 12

  
12 13
###> friendsofphp/php-cs-fixer ###
website/src/Kernel.php
2 2

  
3 3
namespace App;
4 4

  
5
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
6
use Symfony\Component\Config\Loader\LoaderInterface;
5
use const PHP_VERSION_ID;
7 6
use Symfony\Component\Config\Resource\FileResource;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
7
use Symfony\Component\Config\Loader\LoaderInterface;
10 8
use Symfony\Component\Routing\RouteCollectionBuilder;
9
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
10
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
11
use Symfony\Component\DependencyInjection\ContainerBuilder;
12
use function dirname;
11 13

  
12
class Kernel extends BaseKernel
13
{
14
class Kernel extends BaseKernel {
14 15
    use MicroKernelTrait;
15 16

  
16 17
    private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
17 18

  
18
    public function registerBundles(): iterable
19
    {
19
    public function registerBundles(): iterable {
20 20
        $contents = require $this->getProjectDir().'/config/bundles.php';
21 21
        foreach ($contents as $class => $envs) {
22 22
            if ($envs[$this->environment] ?? $envs['all'] ?? false) {
......
25 25
        }
26 26
    }
27 27

  
28
    public function getProjectDir(): string
29
    {
30
        return \dirname(__DIR__);
28
    public function getProjectDir(): string {
29
        return dirname(__DIR__);
31 30
    }
32 31

  
33
    protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
34
    {
32
    protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void {
35 33
        $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
36
        $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
34
        $container->setParameter('container.dumper.inline_class_loader', PHP_VERSION_ID < 70400 || $this->debug);
37 35
        $container->setParameter('container.dumper.inline_factories', true);
38 36
        $confDir = $this->getProjectDir().'/config';
39 37

  
......
43 41
        $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
44 42
    }
45 43

  
46
    protected function configureRoutes(RouteCollectionBuilder $routes): void
47
    {
44
    protected function configureRoutes(RouteCollectionBuilder $routes): void {
48 45
        $confDir = $this->getProjectDir().'/config';
49 46

  
50 47
        $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
website/symfony.code-workspace
7 7
	"settings": {
8 8
		"php.suggest.basic":false,
9 9
		"files.autoSave": "afterDelay",
10
		"php-cs-fixer.executablePath": "/var/www/symfony/vendor/bin/php-cs-fixer",
11
		"php-cs-fixer.config": ".php_cs;.php_cs.dist",
12
		"php-cs-fixer.onsave": true
10 13
	},
11 14
	"extensions": {
12 15
		"recommendations": [
13 16
			"vscode-icons-team.vscode-icons",
14 17
			"felixfbecker.php-intellisense",
15
			"whatwedo.twig"
18
			"whatwedo.twig",
19
			"felixfbecker.php-debug",
20
			"junstyle.php-cs-fixer"
16 21
		]
17 22
	},
18 23
	"tasks": {
19 24
		"version": "2.0.0",
20 25
		"tasks": [{
21
			"label": "PHP Linter",
26
			"label": "PHP Linter (DOCKER SERVICE)",
22 27
			"command": "docker-compose",
23
			"args": ["exec", "php-fpm", "/var/www/symfony/vendor/bin/php-cs-fixer","fix", "--dry-run", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation", "--using-cache=no"],
28
			"args": ["exec", "php-fpm", "./vendor/bin/php-cs-fixer", "fix", "/var/www/symfony/src", "--dry-run", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation", "--using-cache=no"],
24 29
			"windows":{
25 30
				"command": "docker-compose",
26
				"args": ["exec", "php-fpm", "/var/www/symfony/vendor/bin/php-cs-fixer", "fix", "--dry-run", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation", "--using-cache=no"],
31
				"args": ["exec", "php-fpm","./vendor/bin/php-cs-fixer", "fix", "/var/www/symfony/src", "--dry-run", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation", "--using-cache=no"],
27 32
			}
28 33
		},
29 34
		{
30
			"label": "Format",
35
			"label": "Format (DOCKER SERVICE)",
36
			"command": "docker-compose",
37
			"args": ["exec", "php-fpm", "/var/www/symfony/vendor/bin/php-cs-fixer", "fix", "/var/www/symfony/src", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation"],
38
			"windows":{
39
				"command": "docker-compose",
40
				"args": ["exec", "php-fpm", "/var/www/symfony/vendor/bin/php-cs-fixer", "fix", "/var/www/symfony/src", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation"],
41
			}
42
		},{
43
			"label": "PHP Linter",
31 44
			"command": "docker-compose",
32
			"args": ["exec", "php-fpm", "/var/www/symfony/vendor/bin/php-cs-fixer","fix", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation"],
45
			"args": ["exec", "php-fpm", "./vendor/bin/php-cs-fixer", "fix", "/var/www/symfony/src", "--dry-run", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation", "--using-cache=no"],
33 46
			"windows":{
34 47
				"command": "docker-compose",
35
				"args": ["exec", "php-fpm", "/var/www/symfony/vendor/bin/php-cs-fixer", "fix", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation"],
48
				"args": ["exec", "php-fpm","./vendor/bin/php-cs-fixer", "fix", "/var/www/symfony/src", "--dry-run", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation", "--using-cache=no"],
49
			}
50
		},
51
		{
52
			"label": "Format",
53
			"command": "./vendor/bin/php-cs-fixer",
54
			"args": ["fix", "/var/www/symfony/src", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation"],
55
			"windows":{
56
				"command": "./vendor/bin/php-cs-fixer",
57
				"args": ["fix", "/var/www/symfony/src", "--config", "/var/www/symfony/.php_cs", "--stop-on-violation"],
36 58
			}
37 59
		}]
38 60
	},
39 61
	"launch": {
40
		"configurations": [{
62
		"configurations": [
63
			{
41 64
            "name": "Listen for XDebug",
42 65
            "type": "php",
43
            "request": "launch",
44
			"port": 9000
66
			"request": "launch",
67
			"log": true,
68
			"pathMappings": {
69
				"/var/www/symfony": "${workspaceFolder}/"
70
			},
71
			"port": 9001
45 72
			}]
46 73
	}
47 74
}

Také k dispozici: Unified diff