Skip to content

Commit afd9810

Browse files
dunglas7-zete-7
andauthored
feat: lint projects with Super-Linter (#544)
* feat: lint the project with Super Linter * fixes * fixes * fixes * fix * fix * Update docs/options.md Co-authored-by: Stanislau Kviatkouski <7-zete-7@users.noreply.github.com> * fix * Update docs/tls.md Co-authored-by: Stanislau Kviatkouski <7-zete-7@users.noreply.github.com> --------- Co-authored-by: Stanislau Kviatkouski <7-zete-7@users.noreply.github.com>
1 parent 339821e commit afd9810

19 files changed

+458
-281
lines changed

.editorconfig

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,18 @@
55
root = true
66

77
[*]
8-
# Change these settings to your own preference
9-
indent_style = space
10-
indent_size = 4
11-
12-
# We recommend you to keep these unchanged
13-
end_of_line = lf
148
charset = utf-8
15-
trim_trailing_whitespace = true
169
insert_final_newline = true
17-
18-
[*.{js,html,ts,tsx}]
19-
indent_size = 2
20-
21-
[*.json]
22-
indent_size = 2
23-
24-
[*.md]
25-
trim_trailing_whitespace = false
26-
27-
[*.sh]
28-
indent_style = tab
29-
30-
[*.xml.dist]
10+
end_of_line = lf
3111
indent_style = space
3212
indent_size = 4
3313

34-
[*.{yaml,yml}]
35-
trim_trailing_whitespace = false
36-
37-
[.github/workflows/*.yml]
38-
indent_size = 2
39-
40-
[.gitmodules]
14+
[**/{Dockerfile,Caddyfile,*.sh}]
4115
indent_style = tab
4216

43-
[.php_cs.dist]
44-
indent_style = space
45-
indent_size = 4
46-
47-
[composer.json]
48-
indent_size = 4
49-
50-
[{compose,docker-compose}.{*.yaml,*.yml,yaml,yml}]
17+
[{compose.*yaml,.github/**/*.yaml}]
5118
indent_size = 2
5219

53-
[*.*Dockerfile]
54-
indent_style = tab
55-
56-
[{Caddyfile,*.*Caddyfile}]
57-
indent_style = tab
20+
[**.md]
21+
indent_size = unset
22+
indent_style = unset

.github/linters/zizmor.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
rules:
3+
unpinned-uses:
4+
config:
5+
policies:
6+
"*": ref-pin
Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: CI
23

34
on:
@@ -7,6 +8,9 @@ on:
78
pull_request: ~
89
workflow_dispatch: ~
910

11+
permissions:
12+
contents: read
13+
1014
concurrency:
1115
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1216
cancel-in-progress: true
@@ -16,14 +20,13 @@ jobs:
1620
name: Tests
1721
runs-on: ubuntu-latest
1822
steps:
19-
-
20-
name: Checkout
23+
- name: Checkout code
2124
uses: actions/checkout@v5
22-
-
23-
name: Set up Docker Buildx
25+
with:
26+
persist-credentials: false
27+
- name: Set up Docker Buildx
2428
uses: docker/setup-buildx-action@v3
25-
-
26-
name: Build Docker images
29+
- name: Build Docker images
2730
uses: docker/bake-action@v6
2831
with:
2932
pull: true
@@ -35,42 +38,43 @@ jobs:
3538
*.cache-from=type=gha,scope=${{github.ref}}
3639
*.cache-from=type=gha,scope=refs/heads/main
3740
*.cache-to=type=gha,scope=${{github.ref}},mode=max
38-
-
39-
name: Start services
41+
- name: Start services
4042
run: docker compose up --wait --no-build
41-
-
42-
name: Check HTTP reachability
43+
- name: Check HTTP reachability
4344
run: curl -v --fail-with-body http://localhost
44-
-
45-
name: Check HTTPS reachability
45+
- name: Check HTTPS reachability
4646
if: false # Remove this line when the homepage is configured, or change the path to check
4747
run: curl -v --insecure --fail-with-body https://localhost
48-
-
49-
name: Check Mercure reachability
48+
- name: Check Mercure reachability
5049
run: curl -vI --insecure --fail-with-body https://localhost/.well-known/mercure?topic=test
51-
-
52-
name: Create test database
50+
- name: Create test database
5351
if: false # Remove this line if Doctrine ORM is installed
5452
run: docker compose exec -T php bin/console -e test doctrine:database:create
55-
-
56-
name: Run migrations
53+
- name: Run migrations
5754
if: false # Remove this line if Doctrine Migrations is installed
5855
run: docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction
59-
-
60-
name: Run PHPUnit
56+
- name: Run PHPUnit
6157
if: false # Remove this line if PHPUnit is installed
6258
run: docker compose exec -T php bin/phpunit
63-
-
64-
name: Doctrine Schema Validator
59+
- name: Doctrine Schema Validator
6560
if: false # Remove this line if Doctrine ORM is installed
6661
run: docker compose exec -T php bin/console -e test doctrine:schema:validate
6762
lint:
68-
name: Docker Lint
63+
name: Lint
6964
runs-on: ubuntu-latest
65+
permissions:
66+
contents: read
67+
packages: read
68+
statuses: write
7069
steps:
71-
-
72-
name: Checkout
70+
- name: Checkout
7371
uses: actions/checkout@v5
74-
-
75-
name: Lint Dockerfile
76-
uses: hadolint/hadolint-action@v3.1.0
72+
with:
73+
fetch-depth: 0
74+
persist-credentials: false
75+
- name: Lint Code Base
76+
uses: super-linter/super-linter/slim@v8
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
VALIDATE_CHECKOV: false
80+
VALIDATE_TRIVY: false

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ with [FrankenPHP](https://frankenphp.dev) and [Caddy](https://caddyserver.com/)
1515

1616
## Features
1717

18-
* Production, development and CI ready
19-
* Just 1 service by default
20-
* Blazing-fast performance thanks to [the worker mode of FrankenPHP](https://github.com/dunglas/frankenphp/blob/main/docs/worker.md) (automatically enabled in prod mode)
21-
* [Installation of extra Docker Compose services](docs/extra-services.md) with Symfony Flex
22-
* Automatic HTTPS (in dev and prod)
23-
* HTTP/3 and [Early Hints](https://symfony.com/blog/new-in-symfony-6-3-early-hints) support
24-
* Real-time messaging thanks to a built-in [Mercure hub](https://symfony.com/doc/current/mercure.html)
25-
* [Vulcain](https://vulcain.rocks) support
26-
* Native [XDebug](docs/xdebug.md) integration
27-
* Super-readable configuration
18+
- Production, development and CI ready
19+
- Just 1 service by default
20+
- Blazing-fast performance thanks to [the worker mode of FrankenPHP](https://github.com/dunglas/frankenphp/blob/main/docs/worker.md) (automatically enabled in prod mode)
21+
- [Installation of extra Docker Compose services](docs/extra-services.md) with Symfony Flex
22+
- Automatic HTTPS (in dev and prod)
23+
- HTTP/3 and [Early Hints](https://symfony.com/blog/new-in-symfony-6-3-early-hints) support
24+
- Real-time messaging thanks to a built-in [Mercure hub](https://symfony.com/doc/current/mercure.html)
25+
- [Vulcain](https://vulcain.rocks) support
26+
- Native [XDebug](docs/xdebug.md) integration
27+
- Super-readable configuration
2828

2929
**Enjoy!**
3030

compose.override.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Development environment override
23
services:
34
php:
@@ -21,6 +22,5 @@ services:
2122
# Ensure that host.docker.internal is correctly defined on Linux
2223
- host.docker.internal:host-gateway
2324
tty: true
24-
2525
###> symfony/mercure-bundle ###
2626
###< symfony/mercure-bundle ###

compose.prod.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Production environment override
23
services:
34
php:

compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
services:
23
php:
34
image: ${IMAGES_PREFIX:-}app-php

docs/alpine.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ are known to be slower, and have several known issues.
88

99
To switch to Alpine-based images, apply the following changes to the `Dockerfile`:
1010

11+
<!-- markdownlint-disable MD010 -->
12+
1113
```patch
12-
-FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream
13-
+FROM dunglas/frankenphp:1-php8.3-alpine AS frankenphp_upstream
14+
-FROM dunglas/frankenphp:1-php8.4 AS frankenphp_upstream
15+
+FROM dunglas/frankenphp:1-php8.4-alpine AS frankenphp_upstream
1416

1517
-# hadolint ignore=DL3008
1618
-RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -21,9 +23,10 @@ To switch to Alpine-based images, apply the following changes to the `Dockerfile
2123
- && rm -rf /var/lib/apt/lists/*
2224
+# hadolint ignore=DL3018
2325
+RUN apk add --no-cache \
24-
+ acl \
25-
+ file \
26-
+ gettext \
27-
+ git \
28-
+ ;
26+
+ acl \
27+
+ file \
28+
+ gettext \
29+
+ git
2930
```
31+
32+
<!-- markdownlint-enable MD010 -->

docs/existing-project.md

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,72 @@ It's also possible to use Symfony Docker with existing projects!
44

55
First, [download this skeleton](https://github.com/dunglas/symfony-docker).
66

7-
If you cloned the Git repository, be sure to not copy the `.git` directory to prevent conflicts with the `.git` directory already in your existing project.
8-
You can copy the contents of the repository using git and tar. This will not contain `.git` or any uncommited changes.
7+
If you cloned the Git repository, be sure to not copy the `.git` directory
8+
to prevent conflicts with the `.git` directory already in your existing project.
99

10-
git archive --format=tar HEAD | tar -xC my-existing-project/
10+
You can copy the contents of the repository using Git and tar.
11+
This will not contain `.git` or any uncommited changes.
1112

12-
If you downloaded the skeleton as a zip you can just copy the extracted files:
13+
```console
14+
git archive --format=tar HEAD | tar -xC my-existing-project/
15+
```
1316

14-
cp -Rp symfony-docker/. my-existing-project/
17+
If you downloaded the skeleton as a ZIP you can just copy the extracted files:
18+
19+
```console
20+
cp -Rp symfony-docker/. my-existing-project/
21+
```
1522

1623
Enable the Docker support of Symfony Flex:
1724

18-
composer config --json extra.symfony.docker 'true'
25+
```console
26+
composer config --json extra.symfony.docker 'true'
27+
```
28+
29+
If you want to use the [worker mode of FrankenPHP](https://github.com/php/frankenphp/blob/main/docs/worker.md),
30+
add the FrankenPHP runtime for Symfony:
1931

20-
If you want to use the [worker mode of FrankenPHP](https://github.com/php/frankenphp/blob/main/docs/worker.md), add the FrankenPHP runtime for Symfony:
21-
22-
composer require runtime/frankenphp-symfony
32+
```console
33+
composer require runtime/frankenphp-symfony
34+
```
2335

2436
> [!TIP]
25-
> With Symfony 7.4, the `runtime/frankenphp-symfony` package isn't required anymore, as Symfony Runtime natively supports FrankenPHP worker mode.
37+
>
38+
> With Symfony 7.4, the `runtime/frankenphp-symfony` package isn't required anymore,
39+
> as Symfony Runtime natively supports FrankenPHP worker mode.
2640
27-
Re-execute the recipes to update the Docker-related files according to the packages you use:
41+
Re-execute the recipes to update the Docker-related files according to
42+
the packages you use:
2843

29-
rm symfony.lock
30-
composer recipes:install --force --verbose
44+
```console
45+
rm symfony.lock
46+
composer recipes:install --force --verbose
47+
```
3148

3249
Double-check the changes, revert the changes that you don't want to keep:
3350

34-
git diff
35-
...
51+
```console
52+
git diff
53+
```
3654

3755
Build the Docker images:
3856

39-
docker compose build --pull --no-cache
57+
```console
58+
docker compose build --pull --no-cache
59+
```
4060

4161
Start the project!
4262

43-
docker compose up --wait
63+
```console
64+
docker compose up --wait
65+
```
4466

4567
Browse `https://localhost`, your Docker configuration is ready!
4668

4769
> [!NOTE]
48-
> The worker mode of FrankenPHP is enabled by default in the Caddyfile. To disabled it, comment the `worker {}` section of this file.
49-
> You may also remove `runtime/frankenphp-symfony` if you never plan on using the worker mode.
70+
>
71+
> The worker mode of FrankenPHP is enabled by default in the Caddyfile.
72+
> To disabled it, comment the `worker {}` section of this file.
73+
>
74+
> You may also remove `runtime/frankenphp-symfony`
75+
> if you never plan on using the worker mode.

docs/extra-services.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
# Support for Extra Services
22

3-
Symfony Docker is extensible. When you install a compatible Composer package using Symfony Flex,
4-
the recipe will automatically modify the `Dockerfile` and `compose.yaml` to fulfill the requirements of this package.
3+
Symfony Docker is extensible.
4+
When you install a compatible Composer package using Symfony Flex,
5+
the recipe will automatically modify the `Dockerfile` and `compose.yaml` files
6+
to fulfill the requirements of this package.
57

68
The currently supported packages are:
79

8-
* `symfony/orm-pack`: install a PostgreSQL service
9-
* `symfony/mercure-bundle`: use the Mercure.rocks module shipped with Caddy
10-
* `symfony/panther`: install chromium and these drivers
11-
* `symfony/mailer`: install a Mailpit service
12-
* `blackfireio/blackfire-symfony-meta`: install a Blackfire service
10+
- `symfony/orm-pack`: install a PostgreSQL service
11+
- `symfony/mercure-bundle`: use the Mercure.rocks module shipped with Caddy
12+
- `symfony/panther`: install chromium and these drivers
13+
- `symfony/mailer`: install a Mailpit service
14+
- `blackfireio/blackfire-symfony-meta`: install a Blackfire service
1315

1416
> [!NOTE]
17+
>
1518
> If a recipe modifies the Dockerfile, the container needs to be rebuilt.
1619
20+
<!-- -->
21+
1722
> [!WARNING]
18-
> We recommend that you use the `composer require` command inside the container in development mode so that recipes can be applied correctly
23+
>
24+
> We recommend that you use the `composer require` command inside the container
25+
> in development mode so that recipes can be applied correctly

0 commit comments

Comments
 (0)