Skip to content

Commit c9ec29e

Browse files
trim dependencies to the bare minimum (#4)
Co-authored-by: Jeffrey Wong <jwong@dayspringpartners.com>
1 parent 714dc02 commit c9ec29e

File tree

10 files changed

+134
-47
lines changed

10 files changed

+134
-47
lines changed

.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Docker-Compose settings for develop
2+
COMPOSE_PROJECT_NAME=login-bundle
3+
COMPOSE_FILE=./docker/docker-compose.yml:./docker/docker-compose.dev.yml
4+
REPOSITORY_NAME=test
5+
IMAGE_TAG=latest
6+
7+
## Docker Volumes
8+
COMPOSER_HOME_VOL=${COMPOSER_HOME:-$HOME/.config/composer}:/tmp

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ crashlytics.properties
4848
crashlytics-build.properties
4949
fabric.properties
5050
build
51-
51+
var

Tests/Framework/Test/ServiceTestCaseTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ protected static function getKernelClass()
1515

1616
public function testCreateService()
1717
{
18-
$routing = static::$kernel->getContainer()->get('router');
19-
$testService = self::createService('router');
18+
$this->assertNotEmpty(static::$kernel->getContainer()->getServiceIds());
2019

21-
$this->assertEquals($routing, $testService);
20+
$kernel = static::$kernel->getContainer()->get('kernel');
21+
$testService = self::createService('kernel');
22+
23+
$this->assertEquals($kernel, $testService);
2224
}
2325
}

Tests/Resources/config/config.yml

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
imports:
2-
- { resource: security.yml }
3-
4-
framework:
5-
test: ~
6-
secret: xxxxxxxxxx
7-
router: { resource: "%kernel.project_dir%/config/routing.yml" }
8-
form: ~
9-
csrf_protection: ~
10-
annotations: { enabled: true }
11-
validation: { enable_annotations: true }
12-
#serializer: { enable_annotations: true }
13-
# templating: { engines: ['twig', 'php'] }
14-
session:
15-
storage_id: session.storage.mock_file
16-
profiler:
17-
collect: false
18-
19-
twig:
20-
debug: "%kernel.debug%"
21-
strict_variables: "%kernel.debug%"
22-
1+
#framework:
2+
# test: ~
3+
# secret: xxxxxxxxxx
4+
# router: { resource: "%kernel.project_dir%/config/routing.yml" }
5+
# form: ~
6+
# csrf_protection: ~
7+
# annotations: { enabled: true }
8+
# validation: { enable_annotations: true }
9+
# #serializer: { enable_annotations: true }
10+
## templating: { engines: ['twig', 'php'] }
11+
# session:
12+
# storage_id: session.storage.mock_file
13+
# profiler:
14+
# collect: false
15+
#
16+
#

Tests/Resources/config/security.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

Tests/TestKernel.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,6 @@ public function getRootDir()
1414
public function registerBundles()
1515
{
1616
return array(
17-
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
18-
new \Symfony\Bundle\SecurityBundle\SecurityBundle(),
19-
new \Symfony\Bundle\TwigBundle\TwigBundle(),
20-
// new \Symfony\Bundle\MonologBundle\MonologBundle(),
21-
// new \Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
22-
// new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
23-
// new \Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
24-
// new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
25-
// new \Propel\Bundle\PropelBundle\PropelBundle(),
26-
// new \Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle(),
27-
// new \Dayspring\LoginBundle\DayspringLoginBundle(),
28-
29-
// new JMS\AopBundle\JMSAopBundle(),
30-
// new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
3117
);
3218
}
3319
public function registerContainerConfiguration(LoaderInterface $loader)

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
],
2222
"require": {
2323
"php": ">=7.4",
24-
"symfony/framework-bundle": "^4.4.12|^5.0",
25-
"symfony/symfony": "^4.4.12|^5.0",
24+
"symfony/http-kernel": "^4.4.12|^5.0",
2625
"phpunit/phpunit": "^8.5.23|^9.0"
2726
},
2827
"require-dev": {
29-
"doctrine/annotations": "^1.13.0"
28+
"symfony/config": "^4.4.12|^5.0",
29+
"symfony/dependency-injection": "^4.4.12|^5.0",
30+
"symfony/yaml": "^4.4.12|^5.0"
3031
},
3132
"autoload": {
3233
"psr-4": {

docker/docker-compose.dev.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: '3.7'
2+
3+
services:
4+
symfony:
5+
volumes:
6+
- ..:/usr/src/symfony

docker/docker-compose.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: '3.7'
2+
3+
services:
4+
symfony:
5+
build:
6+
context: ./symfony
7+
args:
8+
PHP_VERSION: 8.1
9+
image: '${COMPOSE_PROJECT_NAME}/${REPOSITORY_NAME}_symfony:${IMAGE_TAG}'
10+
container_name: '${REPOSITORY_NAME}_symfony'
11+
hostname: '${REPOSITORY_NAME}-symfony'
12+
volumes:
13+
- symfony-app:/usr/src/symfony
14+
15+
volumes:
16+
symfony-app: {}

docker/symfony/Dockerfile

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
ARG PHP_VERSION=latest
2+
FROM php:${PHP_VERSION}-fpm-alpine
3+
4+
RUN set -eux; \
5+
apk add --no-cache --virtual .composer-rundeps \
6+
bash \
7+
coreutils \
8+
git \
9+
make \
10+
mercurial \
11+
openssh-client \
12+
patch \
13+
mysql-client \
14+
subversion \
15+
tini \
16+
unzip \
17+
zip
18+
19+
RUN set -eux; \
20+
apk add --no-cache --virtual .build-deps \
21+
icu-dev \
22+
libxml2-dev \
23+
libxslt-dev \
24+
libzip-dev \
25+
mysql-dev \
26+
zlib-dev \
27+
; \
28+
docker-php-ext-install -j "$(nproc)" \
29+
intl \
30+
pdo \
31+
mysqli \
32+
pdo_mysql \
33+
soap \
34+
xsl \
35+
zip \
36+
; \
37+
runDeps="$( \
38+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
39+
| tr ',' '\n' \
40+
| sort -u \
41+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
42+
)"; \
43+
apk add --no-cache --virtual .composer-phpext-rundeps $runDeps; \
44+
apk del .build-deps
45+
46+
RUN printf "# composer php cli ini settings\n\
47+
date.timezone=UTC\n\
48+
memory_limit=-1\n\
49+
" > $PHP_INI_DIR/php-cli.ini
50+
51+
ENV COMPOSER_ALLOW_SUPERUSER 1
52+
ENV COMPOSER_HOME /tmp
53+
ENV COMPOSER_VERSION 2.4.4
54+
ENV COMPOSER_INSTALLER_URL https://raw.githubusercontent.com/composer/getcomposer.org/cb19f2aa3aeaa2006c0cd69a7ef011eb31463067/web/installer
55+
ENV COMPOSER_INSTALLER_HASH 48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5
56+
57+
RUN set -eux; \
58+
curl --silent --fail --location --retry 3 --output /tmp/installer.php --url ${COMPOSER_INSTALLER_URL}; \
59+
php -r " \
60+
\$signature = '${COMPOSER_INSTALLER_HASH}'; \
61+
\$hash = hash('sha384', file_get_contents('/tmp/installer.php')); \
62+
if (!hash_equals(\$signature, \$hash)) { \
63+
unlink('/tmp/installer.php'); \
64+
echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
65+
exit(1); \
66+
}"; \
67+
php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION}; \
68+
composer --ansi --version --no-interaction; \
69+
rm -f /tmp/installer.php; \
70+
find /tmp -type d -exec chmod -v 1777 {} +
71+
72+
# install phpunit
73+
RUN wget https://phar.phpunit.de/phpunit-6.1.phar && \
74+
chmod +x phpunit-6.1.phar && \
75+
mv phpunit-6.1.phar /usr/local/bin/phpunit
76+
77+
WORKDIR /usr/src/symfony
78+
ENV PS1="\u@\h:\w\\$ "

0 commit comments

Comments
 (0)