Skip to content

Commit d73afba

Browse files
committed
Add initial project structure and configuration files
1 parent 5270bc9 commit d73afba

File tree

98 files changed

+20483
-46
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+20483
-46
lines changed

.castor.stub.php

Lines changed: 5634 additions & 0 deletions
Large diffs are not rendered by default.

.dockerignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
**/*.log
2+
**/*.md
3+
**/*.php~
4+
**/*.dist.php
5+
**/*.dist
6+
**/*.cache
7+
**/._*
8+
**/.dockerignore
9+
**/.DS_Store
10+
**/.git/
11+
**/.gitattributes
12+
**/.gitignore
13+
**/.gitmodules
14+
**/compose.*.yaml
15+
**/compose.*.yml
16+
**/compose.yaml
17+
**/compose.yml
18+
**/docker-compose.*.yaml
19+
**/docker-compose.*.yml
20+
**/docker-compose.yaml
21+
**/docker-compose.yml
22+
**/Dockerfile
23+
**/Thumbs.db
24+
.github/
25+
docs/
26+
public/bundles/
27+
tests/
28+
var/
29+
vendor/
30+
.editorconfig
31+
.env.*.local
32+
.env.local
33+
.env.local.php
34+
.env.test

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
indent_size = 4
9+
indent_style = space
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[{compose.yaml,compose.*.yaml}]
14+
indent_size = 2
15+
16+
[*.md]
17+
trim_trailing_whitespace = false

.env

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# In all environments, the following files are loaded if they exist,
2+
# the latter taking precedence over the former:
3+
#
4+
# * .env contains default values for the environment variables needed by the app
5+
# * .env.local uncommitted file with local overrides
6+
# * .env.$APP_ENV committed environment-specific defaults
7+
# * .env.$APP_ENV.local uncommitted environment-specific overrides
8+
#
9+
# Real environment variables win over .env files.
10+
#
11+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
# https://symfony.com/doc/current/configuration/secrets.html
13+
#
14+
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
15+
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
16+
17+
###> symfony/framework-bundle ###
18+
APP_ENV=dev
19+
APP_SECRET=
20+
###< symfony/framework-bundle ###
21+
22+
###> doctrine/doctrine-bundle ###
23+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
24+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
25+
#
26+
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db"
27+
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
28+
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
29+
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
30+
###< doctrine/doctrine-bundle ###
31+
32+
###> symfony/messenger ###
33+
# Choose one of the transports below
34+
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
35+
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
36+
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
37+
###< symfony/messenger ###
38+
39+
###> symfony/mailer ###
40+
MAILER_DSN=null://null
41+
###< symfony/mailer ###

.env.dev

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
###> symfony/framework-bundle ###
3+
APP_SECRET=234991ec41873893805fa5f1bc23f491
4+
###< symfony/framework-bundle ###

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
* text=auto eol=lf
2+
3+
*.conf text eol=lf
4+
*.html text eol=lf
5+
*.ini text eol=lf
6+
*.js text eol=lf
7+
*.json text eol=lf
8+
*.md text eol=lf
9+
*.php text eol=lf
10+
*.sh text eol=lf
11+
*.yaml text eol=lf
12+
*.yml text eol=lf
13+
bin/console text eol=lf
14+
composer.lock text eol=lf merge=ours
15+
16+
*.ico binary
17+
*.png binary

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request: ~
8+
workflow_dispatch: ~
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
tests:
16+
name: Tests
17+
runs-on: ubuntu-latest
18+
steps:
19+
-
20+
name: Checkout
21+
uses: actions/checkout@v4
22+
-
23+
name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
-
26+
name: Build Docker images
27+
uses: docker/bake-action@v6
28+
with:
29+
pull: true
30+
load: true
31+
files: |
32+
compose.yaml
33+
compose.override.yaml
34+
set: |
35+
*.cache-from=type=gha,scope=${{github.ref}}
36+
*.cache-from=type=gha,scope=refs/heads/main
37+
*.cache-to=type=gha,scope=${{github.ref}},mode=max
38+
-
39+
name: Start services
40+
run: docker compose up --wait --no-build
41+
-
42+
name: Check HTTP reachability
43+
run: curl -v --fail-with-body http://localhost
44+
-
45+
name: Check HTTPS reachability
46+
if: false # Remove this line when the homepage will be configured, or change the path to check
47+
run: curl -v --insecure --fail-with-body https://localhost
48+
-
49+
name: Check Mercure reachability
50+
run: curl -vI --insecure --fail-with-body https://localhost/.well-known/mercure?topic=test
51+
-
52+
name: Create test database
53+
if: false # Remove this line if Doctrine ORM is installed
54+
run: docker compose exec -T php bin/console -e test doctrine:database:create
55+
-
56+
name: Run migrations
57+
if: false # Remove this line if Doctrine Migrations is installed
58+
run: docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction
59+
-
60+
name: Run PHPUnit
61+
if: false # Remove this line if PHPUnit is installed
62+
run: docker compose exec -T php bin/phpunit
63+
-
64+
name: Doctrine Schema Validator
65+
if: false # Remove this line if Doctrine ORM is installed
66+
run: docker compose exec -T php bin/console -e test doctrine:schema:validate
67+
lint:
68+
name: Docker Lint
69+
runs-on: ubuntu-latest
70+
steps:
71+
-
72+
name: Checkout
73+
uses: actions/checkout@v4
74+
-
75+
name: Lint Dockerfile
76+
uses: hadolint/hadolint-action@v3.1.0

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
###> symfony/framework-bundle ###
2+
/.env.local
3+
/.env.local.php
4+
/.env.*.local
5+
/config/secrets/prod/prod.decrypt.private.php
6+
/public/bundles/
7+
/var/
8+
/vendor/
9+
###< symfony/framework-bundle ###
10+
###> symfony/asset-mapper ###
11+
/public/assets/
12+
/assets/vendor/
13+
###< symfony/asset-mapper ###

Dockerfile

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#syntax=docker/dockerfile:1
2+
3+
# Versions
4+
FROM dunglas/frankenphp:1-php8.4 AS frankenphp_upstream
5+
6+
# The different stages of this Dockerfile are meant to be built into separate images
7+
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
8+
# https://docs.docker.com/compose/compose-file/#target
9+
10+
11+
# Base FrankenPHP image
12+
FROM frankenphp_upstream AS frankenphp_base
13+
14+
WORKDIR /app
15+
16+
VOLUME /app/var/
17+
18+
# persistent / runtime deps
19+
# hadolint ignore=DL3008
20+
RUN apt-get update && apt-get install -y --no-install-recommends \
21+
acl \
22+
file \
23+
gettext \
24+
git \
25+
&& rm -rf /var/lib/apt/lists/*
26+
27+
RUN set -eux; \
28+
install-php-extensions \
29+
@composer \
30+
apcu \
31+
intl \
32+
opcache \
33+
zip \
34+
;
35+
36+
37+
RUN set -eux; \
38+
install-php-extensions \
39+
@composer \
40+
pdo_pgsql \
41+
gmp \
42+
gd \
43+
imagick \
44+
amqp \
45+
fileinfo \
46+
iconv \
47+
exif \
48+
gettext \
49+
uuid \
50+
xsl \
51+
xml \
52+
zip \
53+
brotli \
54+
zstd \
55+
;
56+
57+
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
58+
ENV COMPOSER_ALLOW_SUPERUSER=1
59+
60+
# Transport to use by Mercure (default to Bolt)
61+
ENV MERCURE_TRANSPORT_URL=bolt:///data/mercure.db
62+
63+
ENV PHP_INI_SCAN_DIR=":$PHP_INI_DIR/app.conf.d"
64+
65+
###> recipes ###
66+
###< recipes ###
67+
68+
COPY --link frankenphp/conf.d/10-app.ini $PHP_INI_DIR/app.conf.d/
69+
COPY --link --chmod=755 frankenphp/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
70+
COPY --link frankenphp/Caddyfile /etc/frankenphp/Caddyfile
71+
72+
ENTRYPOINT ["docker-entrypoint"]
73+
74+
HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1
75+
CMD [ "frankenphp", "run", "--config", "/etc/frankenphp/Caddyfile" ]
76+
77+
# Dev FrankenPHP image
78+
FROM frankenphp_base AS frankenphp_dev
79+
80+
ENV APP_ENV=dev
81+
ENV XDEBUG_MODE=off
82+
ENV FRANKENPHP_WORKER_CONFIG=watch
83+
84+
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
85+
86+
RUN set -eux; \
87+
install-php-extensions \
88+
xdebug \
89+
;
90+
91+
COPY --link frankenphp/conf.d/20-app.dev.ini $PHP_INI_DIR/app.conf.d/
92+
93+
CMD [ "frankenphp", "run", "--config", "/etc/frankenphp/Caddyfile", "--watch" ]
94+
95+
# Prod FrankenPHP image
96+
FROM frankenphp_base AS frankenphp_prod
97+
98+
ENV APP_ENV=prod
99+
100+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
101+
102+
COPY --link frankenphp/conf.d/20-app.prod.ini $PHP_INI_DIR/app.conf.d/
103+
104+
# prevent the reinstallation of vendors at every changes in the source code
105+
COPY --link composer.* symfony.* ./
106+
RUN set -eux; \
107+
composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress
108+
109+
# copy sources
110+
COPY --link . ./
111+
RUN rm -Rf frankenphp/
112+
113+
RUN set -eux; \
114+
mkdir -p var/cache var/log; \
115+
composer dump-autoload --classmap-authoritative --no-dev; \
116+
composer dump-env prod; \
117+
composer run-script --no-dev post-install-cmd; \
118+
chmod +x bin/console; sync;

0 commit comments

Comments
 (0)