Start building out a PHP container that will run the server.

This commit is contained in:
Dave Smith-Hayes 2024-07-17 22:05:42 -04:00
parent 982d348a34
commit 5c72cdbfd5
5 changed files with 37 additions and 4 deletions

View File

@ -2,18 +2,21 @@
namespace Slovocast\Controller;
use Slovocast\Controller\Controller;
use Slovocast\Domain\Repository\Channel\ChannelRepositoryInterface;
use Slovocast\Domain\Repository\User\UserRepositoryInterface;
use Psr\Http\Message\ResponseInterface as Response;
class DashboardPage extends Controller
{
public function __construct(
protected UserRepositoryInterface $userRepository
protected UserRepositoryInterface $userRepository,
protected ChannelRepositoryInterface $channelRepository
) { }
public function handle(): Response
{
// get the user details
// get the channels
return $this->render('dashboard.twig');
}
}

View File

@ -25,6 +25,7 @@ class Routes
$app->get('/healthcheck', HealthCheck::class);
// User Routes
self::users($app);
self::dashboard($app);
}
/**
@ -44,7 +45,10 @@ class Routes
$app->post('/login', LoginUserAction::class)
->add(AuthenticatedMiddleware::class)
->setName('user-login-action');
}
protected static function dashboard(App $app): void
{
$app->get('/dashboard', DashboardPage::class)
->add(AuthenticatedMiddleware::class)
->setName('user-dashboard');

View File

@ -14,7 +14,7 @@
</header>
<main>
{% include 'components/flash.twig' %}
{% include 'layouts/components/flash.twig' %}
{% block content %}{% endblock %}

20
deploy/php/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM php:8.3-alpine
# Install PHP extensions
RUN apk add --no-cache zip libzip-dev \
&& docker-php-ext-install pdo_mysql zip
# Install composer
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/bin/composer
# Install xdebug
RUN apk add --no-cache $PHPIZE_DEPS
# && pecl install xdebug-2.7.1 \
# && docker-php-ext-enable xdebug \
# && echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
WORKDIR /app
COPY ./app /app
CMD [ "php", "server/server.php" ]

View File

@ -2,7 +2,7 @@ version: '3.9'
services:
database:
image: mariadb:latest
image: mariadb:latest
environment:
MARIADB_DATABASE: "slovocast"
MARIADB_USER: "slovocast"
@ -12,5 +12,11 @@ services:
- "3306:3306"
volumes:
- slovocast_db:/var/lib/mysql/data/
app:
build:
dockerfile: ./deploy/php/Dockerfile
volumes:
- ./app:/app
volumes:
slovocast_db: