Skip to content

Commit 64d60a9

Browse files
authored
Merge pull request #114 from Coderberg/2.x
2.x
2 parents ea82d64 + 04a211a commit 64d60a9

Some content is hidden

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

48 files changed

+2431
-1792
lines changed

.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

.env

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@
99
# Real environment variables win over .env files.
1010
#
1111
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
# https://symfony.com/doc/current/configuration/secrets.html
1213
#
1314
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
1415
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
1516

1617
###> symfony/framework-bundle ###
1718
APP_ENV=dev
18-
APP_SECRET=6feff92fb5278f215ddca9545d19fcd3
19+
APP_SECRET=421f03e82270a0883f2db17c436d6b81
1920
###< symfony/framework-bundle ###
2021

2122
###> doctrine/doctrine-bundle ###
2223
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
2324
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
2425
#
2526
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
26-
DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
27+
DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.35&charset=utf8mb4"
2728
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
2829
# DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=15&charset=utf8"
2930
###< doctrine/doctrine-bundle ###
3031

3132
###> symfony/mailer ###
3233
# MAILER_DSN=smtp://user:[email protected]
33-
# MAILER_DSN=gmail://USERNAME:PASSWORD@default
3434
MAILER_DSN=null://localhost
3535
###< symfony/mailer ###
3636

@@ -41,9 +41,6 @@ MAILER_DSN=null://localhost
4141
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
4242
###< symfony/messenger ###
4343

44-
# Select default language (en, ru, bg, nl)
45-
LANGUAGE_CODE=en
46-
4744
###> symfony/google-mailer ###
4845
# Gmail SHOULD NOT be used on production, use it in development only.
4946
# MAILER_DSN=gmail://USERNAME:PASSWORD@default
@@ -54,3 +51,6 @@ LANGUAGE_CODE=en
5451
# postgresql+advisory://db_user:db_password@localhost/db_name
5552
LOCK_DSN=flock
5653
###< symfony/lock ###
54+
55+
# Select default language (en, ru, bg, nl)
56+
LANGUAGE_CODE=en

.env.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ APP_SECRET='$ecretf0rt3st'
44
SYMFONY_DEPRECATIONS_HELPER=999999
55
PANTHER_APP_ENV=test
66
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
7-
DATABASE_URL=mysql://db_user:[email protected]:3306/db_name
7+
DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.35&charset=utf8mb4"
8+
9+
PANTHER_CHROME_ARGUMENTS="--disable-dev-shm-usage"
10+
PANTHER_NO_SANDBOX="1"

.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/frankenphp.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: FrankenPHP
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 2.x
8+
pull_request: ~
9+
workflow_dispatch: ~
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
tests:
17+
name: Tests
18+
runs-on: ubuntu-latest
19+
steps:
20+
-
21+
name: Checkout
22+
uses: actions/checkout@v4
23+
-
24+
name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
-
27+
name: Build Docker images
28+
uses: docker/bake-action@v4
29+
with:
30+
pull: true
31+
load: true
32+
files: |
33+
compose.yaml
34+
compose.override.yaml
35+
set: |
36+
*.cache-from=type=gha,scope=${{github.ref}}
37+
*.cache-from=type=gha,scope=refs/heads/main
38+
*.cache-to=type=gha,scope=${{github.ref}},mode=max
39+
-
40+
name: Start services
41+
run: docker compose up --wait --no-build
42+
-
43+
name: Check HTTP reachability
44+
run: curl -v -o /dev/null http://localhost
45+
-
46+
name: Check HTTPS reachability
47+
run: curl -vk -o /dev/null https://localhost
48+
-
49+
name: Install the app
50+
run: docker compose exec -T php bin/console -e test app:install
51+
-
52+
name: Run PHPUnit
53+
run: docker compose exec -T php bin/phpunit
54+
-
55+
name: Doctrine Schema Validator
56+
run: docker compose exec -T php bin/console -e test doctrine:schema:validate

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
matrix:
1919
fast_finish: true
2020
include:
21-
- php: 8.1
21+
- php: 8.2
2222

2323
before_install:
2424
- '[[ -z $SYMFONY ]] || composer config extra.symfony.require "$SYMFONY"'

Dockerfile

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#syntax=docker/dockerfile:1.4
2+
3+
# Versions
4+
FROM dunglas/frankenphp:1-alpine AS frankenphp_upstream
5+
FROM composer/composer:2-bin AS composer_upstream
6+
7+
8+
# The different stages of this Dockerfile are meant to be built into separate images
9+
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
10+
# https://docs.docker.com/compose/compose-file/#target
11+
12+
13+
# Base FrankenPHP image
14+
FROM frankenphp_upstream AS frankenphp_base
15+
16+
WORKDIR /app
17+
18+
# persistent / runtime deps
19+
# hadolint ignore=DL3018
20+
RUN apk add --no-cache \
21+
acl \
22+
file \
23+
gettext \
24+
git \
25+
;
26+
27+
RUN set -eux; \
28+
install-php-extensions \
29+
apcu \
30+
gd \
31+
intl \
32+
opcache \
33+
zip \
34+
;
35+
36+
###> recipes ###
37+
###> symfony/panther ###
38+
# Chromium and ChromeDriver
39+
ENV PANTHER_NO_SANDBOX 1
40+
# Not mandatory, but recommended
41+
ENV PANTHER_CHROME_ARGUMENTS='--disable-dev-shm-usage'
42+
RUN apk add --no-cache chromium chromium-chromedriver
43+
44+
# Firefox and geckodriver
45+
#ARG GECKODRIVER_VERSION=0.29.0
46+
#RUN apk add --no-cache firefox
47+
#RUN wget -q https://github.com/mozilla/geckodriver/releases/download/v$GECKODRIVER_VERSION/geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz; \
48+
# tar -zxf geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz -C /usr/bin; \
49+
# rm geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz
50+
###< symfony/panther ###
51+
###> doctrine/doctrine-bundle ###
52+
RUN install-php-extensions pdo_mysql
53+
###< doctrine/doctrine-bundle ###
54+
###< recipes ###
55+
56+
COPY --link frankenphp/conf.d/app.ini $PHP_INI_DIR/conf.d/
57+
COPY --link --chmod=755 frankenphp/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
58+
COPY --link frankenphp/Caddyfile /etc/caddy/Caddyfile
59+
60+
ENTRYPOINT ["docker-entrypoint"]
61+
62+
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
63+
ENV COMPOSER_ALLOW_SUPERUSER=1
64+
ENV PATH="${PATH}:/root/.composer/vendor/bin"
65+
66+
COPY --from=composer_upstream --link /composer /usr/bin/composer
67+
68+
HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1
69+
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]
70+
71+
# Dev FrankenPHP image
72+
FROM frankenphp_base AS frankenphp_dev
73+
74+
ENV APP_ENV=dev XDEBUG_MODE=off
75+
VOLUME /app/var/
76+
77+
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
78+
79+
RUN set -eux; \
80+
install-php-extensions \
81+
xdebug \
82+
;
83+
84+
COPY --link frankenphp/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/
85+
86+
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ]
87+
88+
# Prod FrankenPHP image
89+
FROM frankenphp_base AS frankenphp_prod
90+
91+
ENV APP_ENV=prod
92+
ENV FRANKENPHP_CONFIG="import worker.Caddyfile"
93+
94+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
95+
96+
COPY --link frankenphp/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/
97+
COPY --link frankenphp/worker.Caddyfile /etc/caddy/worker.Caddyfile
98+
99+
# prevent the reinstallation of vendors at every changes in the source code
100+
COPY --link composer.* symfony.* ./
101+
RUN set -eux; \
102+
composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress
103+
104+
# copy sources
105+
COPY --link . ./
106+
RUN rm -Rf frankenphp/
107+
108+
RUN set -eux; \
109+
mkdir -p var/cache var/log; \
110+
composer dump-autoload --classmap-authoritative --no-dev; \
111+
composer dump-env prod; \
112+
composer run-script --no-dev post-install-cmd; \
113+
chmod +x bin/console; sync;

babel.config.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
module.exports = {
2-
presets: [
3-
[
4-
'@babel/preset-env',
5-
{
6-
modules: 'auto',
7-
targets: { node: 'current' }
8-
}
9-
]
10-
],
11-
plugins: [
12-
[
13-
'@babel/plugin-proposal-class-properties',
14-
{
15-
loose: true
16-
}
17-
]
18-
]
19-
};
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
modules: 'auto',
7+
targets: { node: 'current' }
8+
}
9+
]
10+
],
11+
plugins: [
12+
[
13+
'@babel/plugin-proposal-class-properties',
14+
{
15+
loose: true
16+
}
17+
]
18+
]
19+
};

compose.override.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Development environment override
2+
services:
3+
php:
4+
build:
5+
context: .
6+
target: frankenphp_dev
7+
volumes:
8+
- ./:/app
9+
- ./frankenphp/Caddyfile:/etc/caddy/Caddyfile:ro
10+
- ./frankenphp/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro
11+
# If you develop on Mac or Windows you can remove the vendor/ directory
12+
# from the bind-mount for better performance by enabling the next line:
13+
#- /app/vendor
14+
environment:
15+
MERCURE_EXTRA_DIRECTIVES: demo
16+
# See https://xdebug.org/docs/all_settings#mode
17+
XDEBUG_MODE: "${XDEBUG_MODE:-off}"
18+
extra_hosts:
19+
# Ensure that host.docker.internal is correctly defined on Linux
20+
- host.docker.internal:host-gateway
21+
tty: true
22+
23+
###> symfony/mercure-bundle ###
24+
###< symfony/mercure-bundle ###
25+
26+
###> doctrine/doctrine-bundle ###
27+
mysql:
28+
ports:
29+
- "3306"
30+
###< doctrine/doctrine-bundle ###
31+
32+
###> symfony/mailer ###
33+
mailhog:
34+
image: mailhog/mailhog
35+
ports:
36+
- "1025:1025"
37+
- "8025:8025"
38+
###< symfony/mailer ###

compose.prod.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Production environment override
2+
services:
3+
php:
4+
build:
5+
context: .
6+
target: frankenphp_prod
7+
environment:
8+
APP_SECRET: ${APP_SECRET}
9+
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
10+
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}

0 commit comments

Comments
 (0)