Skip to content

Commit 3b75c81

Browse files
committed
Fixed some issues in the skeleton
- Development is much more easy with a volume in the code - Instead of server:run, it uses server:watch to update changes on realtime
1 parent 94ca4e4 commit 3b75c81

6 files changed

Lines changed: 28 additions & 29 deletions

File tree

Dockerfile

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,12 @@
1-
FROM alpine:3.10
1+
FROM driftphp/base
22

33
WORKDIR /var/www
44

5-
#
6-
# Dependencies
7-
#
8-
RUN apk --no-cache add \
9-
libzip-dev zip wget gnupg curl \
10-
php7 php7-cgi php7-curl php7-opcache php7-zip \
11-
php7-bcmath php7-pcntl php7-redis php7-json \
12-
php7-phar php7-mbstring php7-openssl php7-xml \
13-
php7-tokenizer php7-dom php7-xmlwriter php7-posix \
14-
php7-sockets php7-fileinfo
15-
16-
#
17-
# Composer
18-
#
19-
RUN curl -sS https://getcomposer.org/installer | php \
20-
&& mv composer.phar /usr/bin/composer
21-
225
#
236
# Apisearch installation
247
#
25-
RUN mkdir /var/www/app
26-
COPY . /var/www/app
27-
RUN cd /var/www/app && \
28-
composer install -n --prefer-dist --no-dev --no-suggest && \
8+
COPY . .
9+
RUN composer install -n --prefer-dist --no-dev --no-suggest && \
2910
composer dump-autoload -n --no-dev --optimize
3011

3112
COPY docker/* /

Drift/config/bundles.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
<?php
22

3+
/*
4+
* This file is part of the DriftPHP package.
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*
9+
* Feel free to edit as you please, and have fun.
10+
*
11+
* @author Marc Morera <yuhu@mmoreram.com>
12+
*/
13+
14+
declare(strict_types=1);
15+
316
return [
417
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
518
];

Drift/config/routes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Routes
22
default:
33
path: /
4-
controller: controller.default
4+
controller: App\Controller\DefaultController

bin/console

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Console\Application;
66
use Symfony\Bundle\FrameworkBundle\Console;
77
use Symfony\Component\Console\Input\ArgvInput;
88
use Symfony\Component\Debug\Debug;
9+
use React\EventLoop\Factory as EventLoopFactory;
910

1011
if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
1112
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
@@ -35,6 +36,12 @@ if ($_SERVER['APP_DEBUG']) {
3536
}
3637

3738
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
39+
$kernel->boot();
40+
41+
$kernel
42+
->getContainer()
43+
->set('reactphp.event_loop', EventLoopFactory::create());
44+
3845
$application = new Application($kernel);
3946
$application->add(new \Drift\Server\Console\RunServerCommand($bootstrapPath, 'server:run'));
4047
$application->add(new \Drift\Server\Console\WatchServerCommand($bootstrapPath, $argv, 'server:watch'));

docker-compose.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@ services:
66
build: .
77
ports:
88
- "8000:8000"
9-
networks: [main]
10-
11-
networks:
12-
main:
9+
volumes:
10+
- .:/var/www/

docker/server-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22

3-
cd /var/www/app
3+
cd /var/www
44
rm -Rf var
5-
php vendor/bin/server run 0.0.0.0:8000
5+
php vendor/bin/server watch 0.0.0.0:8000

0 commit comments

Comments
 (0)