Skip to content

Commit 7d1a032

Browse files
committed
reduce configuration to minimal + run storybook inside docker
1 parent bf42df5 commit 7d1a032

Some content is hidden

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

76 files changed

+38538
-2461
lines changed

.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,3 @@
77
# Real environment variables win over .env files.
88
#
99
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
10-
SIMPLE_HTTP_PORT=8000
11-
SIMPLE_HTTPS_PORT=4430
12-
SIMPLE_ENTRYPOINT=https://localhost:${SIMPLE_HTTPS_PORT}/api

.storybook/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const config: StorybookConfig = {
1717
},
1818
env: (config) => ({
1919
...config,
20-
ENTRYPOINT: process.env.ENTRYPOINT ?? 'https://localhost/api',
2120
}),
2221
async webpackFinal(config, { configType }) {
2322
config.resolve = {

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#syntax=docker/dockerfile:1.4
2+
3+
4+
# Versions
5+
FROM node:20-alpine AS node_upstream
6+
7+
8+
# Base stage for dev and build
9+
FROM node_upstream AS base
10+
11+
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
12+
# hadolint ignore=DL3018
13+
RUN apk add --no-cache libc6-compat
14+
15+
WORKDIR /srv/app
16+
17+
RUN corepack enable && \
18+
corepack prepare --activate pnpm@latest && \
19+
pnpm config -g set store-dir /.pnpm-store
20+
21+
# Development image
22+
FROM base as dev
23+
24+
EXPOSE 3000
25+
ENV PORT 3000
26+
ENV HOSTNAME localhost
27+
28+
CMD ["sh", "-c", "pnpm install; pnpm storybook"]

Makefile

Lines changed: 0 additions & 18 deletions
This file was deleted.
File renamed without changes.

backend/simple/.env renamed to api/.env

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
1515
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
1616

17+
# API Platform distribution
18+
TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
19+
TRUSTED_HOSTS=^(localhost|php)$
20+
1721
###> symfony/framework-bundle ###
1822
APP_ENV=dev
19-
APP_SECRET=7aeabb40b0a766e29dec75f12f1e37c2
23+
APP_SECRET=!ChangeMe!
2024
###< symfony/framework-bundle ###
2125

2226
###> doctrine/doctrine-bundle ###
@@ -26,9 +30,19 @@ APP_SECRET=7aeabb40b0a766e29dec75f12f1e37c2
2630
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
2731
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
2832
# 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=15&charset=utf8"
33+
DATABASE_URL="postgresql://app:!ChangeMe!@database:5432/app?serverVersion=15&charset=utf8"
3034
###< doctrine/doctrine-bundle ###
3135

3236
###> nelmio/cors-bundle ###
3337
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
3438
###< nelmio/cors-bundle ###
39+
40+
###> symfony/mercure-bundle ###
41+
# See https://symfony.com/doc/current/mercure.html#configuration
42+
# The URL of the Mercure hub, used by the app to publish updates (can be a local URL)
43+
MERCURE_URL=http://php/.well-known/mercure
44+
# The public URL of the Mercure hub, used by the browser to connect
45+
MERCURE_PUBLIC_URL=https://localhost/.well-known/mercure
46+
# The secret used to sign the JWTs
47+
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
48+
###< symfony/mercure-bundle ###

api/.env.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='$ecretf0rt3st'
4+
SYMFONY_DEPRECATIONS_HELPER=999999
5+
PANTHER_APP_ENV=panther
6+
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
7+
8+
# API Platform distribution
9+
TRUSTED_HOSTS=^example\.com|localhost$

api/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/docker/db/data
2+
3+
###> symfony/framework-bundle ###
4+
/.env.local
5+
/.env.local.php
6+
/.env.*.local
7+
/config/secrets/prod/prod.decrypt.private.php
8+
/public/bundles/
9+
/var/
10+
/vendor/
11+
###< symfony/framework-bundle ###
12+
13+
###> friendsofphp/php-cs-fixer ###
14+
/.php-cs-fixer.php
15+
/.php-cs-fixer.cache
16+
###< friendsofphp/php-cs-fixer ###
17+
18+
###> symfony/phpunit-bridge ###
19+
.phpunit.result.cache
20+
/phpunit.xml
21+
###< symfony/phpunit-bridge ###

api/.php-cs-fixer.dist.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__)
5+
->exclude('var')
6+
;
7+
8+
return (new PhpCsFixer\Config())
9+
->setRules([
10+
'@Symfony' => true,
11+
])
12+
->setFinder($finder)
13+
;

backend/simple/Dockerfile renamed to api/Dockerfile

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#syntax=docker/dockerfile:1.4
22

3+
# Adapted from https://github.com/dunglas/symfony-docker
4+
5+
36
# Versions
7+
# hadolint ignore=DL3007
48
FROM dunglas/frankenphp:latest-alpine AS frankenphp_upstream
5-
FROM composer/composer:2-bin AS composer_upstream
69

710

811
# The different stages of this Dockerfile are meant to be built into separate images
@@ -24,20 +27,22 @@ RUN apk add --no-cache \
2427
git \
2528
;
2629

30+
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
31+
ENV COMPOSER_ALLOW_SUPERUSER=1
32+
2733
RUN set -eux; \
28-
install-php-extensions \
34+
install-php-extensions \
35+
@composer \
2936
apcu \
3037
intl \
3138
opcache \
3239
zip \
33-
;
40+
;
3441

3542
###> recipes ###
3643
###> doctrine/doctrine-bundle ###
37-
RUN apk add --no-cache --virtual .pgsql-deps postgresql-dev; \
38-
docker-php-ext-install -j"$(nproc)" pdo_pgsql; \
39-
apk add --no-cache --virtual .pgsql-rundeps so:libpq.so.5; \
40-
apk del .pgsql-deps
44+
RUN set -eux; \
45+
install-php-extensions pdo_pgsql
4146
###< doctrine/doctrine-bundle ###
4247
###< recipes ###
4348

@@ -47,12 +52,6 @@ COPY --link frankenphp/Caddyfile /etc/caddy/Caddyfile
4752

4853
ENTRYPOINT ["docker-entrypoint"]
4954

50-
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
51-
ENV COMPOSER_ALLOW_SUPERUSER=1
52-
ENV PATH="${PATH}:/root/.composer/vendor/bin"
53-
54-
COPY --from=composer_upstream --link /composer /usr/bin/composer
55-
5655
HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1
5756
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]
5857

@@ -66,8 +65,8 @@ RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
6665

6766
RUN set -eux; \
6867
install-php-extensions \
69-
xdebug \
70-
;
68+
xdebug \
69+
;
7170

7271
COPY --link frankenphp/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/
7372

api/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# API
2+
3+
The API will be here.
4+
5+
Refer to the [Getting Started Guide](https://api-platform.com/docs/distribution) for more information.
File renamed without changes.

api/composer.json

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"type": "project",
3+
"license": "MIT",
4+
"require": {
5+
"php": ">=8.2",
6+
"ext-ctype": "*",
7+
"ext-iconv": "*",
8+
"api-platform/core": "^3.2",
9+
"doctrine/doctrine-bundle": "^2.7",
10+
"doctrine/doctrine-migrations-bundle": "^3.2",
11+
"doctrine/orm": "^3.0",
12+
"nelmio/cors-bundle": "^2.2",
13+
"phpstan/phpdoc-parser": "^1.16",
14+
"runtime/frankenphp-symfony": "^0.2",
15+
"symfony/asset": "6.4.*",
16+
"symfony/console": "6.4.*",
17+
"symfony/dotenv": "6.4.*",
18+
"symfony/expression-language": "6.4.*",
19+
"symfony/flex": "^2.2",
20+
"symfony/framework-bundle": "6.4.*",
21+
"symfony/mercure-bundle": "^0.3.5",
22+
"symfony/monolog-bundle": "^3.8",
23+
"symfony/property-access": "6.4.*",
24+
"symfony/property-info": "6.4.*",
25+
"symfony/runtime": "6.4.*",
26+
"symfony/security-bundle": "6.4.*",
27+
"symfony/serializer": "6.4.*",
28+
"symfony/twig-bundle": "6.4.*",
29+
"symfony/validator": "6.4.*",
30+
"symfony/yaml": "6.4.*"
31+
},
32+
"require-dev": {
33+
"api-platform/schema-generator": "^5.0",
34+
"symfony/browser-kit": "6.4.*",
35+
"symfony/css-selector": "6.4.*",
36+
"symfony/debug-bundle": "6.4.*",
37+
"symfony/maker-bundle": "^1.44",
38+
"symfony/phpunit-bridge": "6.4.*",
39+
"symfony/stopwatch": "6.4.*",
40+
"symfony/var-dumper": "6.4.*",
41+
"symfony/web-profiler-bundle": "6.4.*"
42+
},
43+
"config": {
44+
"optimize-autoloader": true,
45+
"preferred-install": {
46+
"*": "dist"
47+
},
48+
"sort-packages": true,
49+
"allow-plugins": {
50+
"symfony/flex": true,
51+
"symfony/runtime": true
52+
}
53+
},
54+
"autoload": {
55+
"psr-4": {
56+
"App\\": "src/"
57+
}
58+
},
59+
"autoload-dev": {
60+
"psr-4": {
61+
"App\\Tests\\": "tests/"
62+
}
63+
},
64+
"replace": {
65+
"paragonie/random_compat": "2.*",
66+
"symfony/polyfill-ctype": "*",
67+
"symfony/polyfill-iconv": "*",
68+
"symfony/polyfill-intl-grapheme": "*",
69+
"symfony/polyfill-intl-normalizer": "*",
70+
"symfony/polyfill-mbstring": "*",
71+
"symfony/polyfill-php82": "*",
72+
"symfony/polyfill-php81": "*",
73+
"symfony/polyfill-php80": "*",
74+
"symfony/polyfill-php72": "*"
75+
},
76+
"scripts": {
77+
"auto-scripts": {
78+
"cache:clear": "symfony-cmd",
79+
"assets:install %PUBLIC_DIR%": "symfony-cmd"
80+
},
81+
"post-install-cmd": [
82+
"@auto-scripts"
83+
],
84+
"post-update-cmd": [
85+
"@auto-scripts"
86+
]
87+
},
88+
"conflict": {
89+
"symfony/symfony": "*"
90+
},
91+
"extra": {
92+
"symfony": {
93+
"allow-contrib": false,
94+
"require": "6.4.*",
95+
"docker": false
96+
}
97+
}
98+
}

0 commit comments

Comments
 (0)