Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1904c999ec | ||
|
|
81266dd64b | ||
|
|
c5e2800e4c | ||
|
|
ef1c14f8da | ||
|
|
7e5080859d | ||
|
|
414916a20d | ||
|
|
70c05946bd | ||
|
|
ede55b9f08 |
@@ -1,2 +1,2 @@
|
|||||||
parameters:
|
parameters:
|
||||||
app.version: '0.1.21'
|
app.version: '0.1.25'
|
||||||
|
|||||||
26501
frontend/package-lock.json
generated
26501
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@ COPY src src/
|
|||||||
RUN composer dump-autoload --optimize --no-dev
|
RUN composer dump-autoload --optimize --no-dev
|
||||||
|
|
||||||
# --- Stage 2: Build frontend ---
|
# --- Stage 2: Build frontend ---
|
||||||
FROM node:lts-alpine AS frontend-build
|
FROM node:22-alpine AS frontend-build
|
||||||
|
|
||||||
WORKDIR /app/frontend
|
WORKDIR /app/frontend
|
||||||
COPY frontend/package.json frontend/package-lock.json ./
|
COPY frontend/package.json frontend/package-lock.json ./
|
||||||
@@ -68,6 +68,9 @@ COPY --from=backend-build /app /var/www/html
|
|||||||
# Frontend from stage 2
|
# Frontend from stage 2
|
||||||
COPY --from=frontend-build /app/frontend/.output/public /var/www/html/frontend/.output/public
|
COPY --from=frontend-build /app/frontend/.output/public /var/www/html/frontend/.output/public
|
||||||
|
|
||||||
|
# Maintenance page
|
||||||
|
COPY infra/prod/maintenance.html /var/www/html/public/maintenance.html
|
||||||
|
|
||||||
# Symfony needs a .env file to boot (variables are overridden by env_file in docker-compose)
|
# Symfony needs a .env file to boot (variables are overridden by env_file in docker-compose)
|
||||||
RUN echo "APP_ENV=prod" > /var/www/html/.env
|
RUN echo "APP_ENV=prod" > /var/www/html/.env
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://127.0.0.1:8083;
|
proxy_pass http://127.0.0.1:8086;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|||||||
@@ -10,6 +10,16 @@ server {
|
|||||||
access_log /dev/stdout;
|
access_log /dev/stdout;
|
||||||
error_log /dev/stderr;
|
error_log /dev/stderr;
|
||||||
|
|
||||||
|
# Mode maintenance : créer /var/www/html/maintenance.on pour activer
|
||||||
|
if (-f /var/www/html/maintenance.on) {
|
||||||
|
return 503;
|
||||||
|
}
|
||||||
|
error_page 503 @maintenance;
|
||||||
|
location @maintenance {
|
||||||
|
root /var/www/html/public;
|
||||||
|
rewrite ^(.*)$ /maintenance.html break;
|
||||||
|
}
|
||||||
|
|
||||||
location ^~ /api/ {
|
location ^~ /api/ {
|
||||||
root /var/www/html/public;
|
root /var/www/html/public;
|
||||||
try_files $uri /index.php?$query_string;
|
try_files $uri /index.php?$query_string;
|
||||||
|
|||||||
62
src/Command/CreateUserCommand.php
Normal file
62
src/Command/CreateUserCommand.php
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Command;
|
||||||
|
|
||||||
|
use App\Entity\User;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||||
|
|
||||||
|
#[AsCommand(
|
||||||
|
name: 'app:create-user',
|
||||||
|
description: 'Create a new user',
|
||||||
|
)]
|
||||||
|
class CreateUserCommand extends Command
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly EntityManagerInterface $em,
|
||||||
|
private readonly UserPasswordHasherInterface $passwordHasher,
|
||||||
|
) {
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configure(): void
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->addArgument('username', InputArgument::REQUIRED, 'Username')
|
||||||
|
->addArgument('password', InputArgument::REQUIRED, 'Plain password')
|
||||||
|
->addOption('admin', null, InputOption::VALUE_NONE, 'Grant ROLE_ADMIN')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
{
|
||||||
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
|
$username = $input->getArgument('username');
|
||||||
|
$plainPassword = $input->getArgument('password');
|
||||||
|
|
||||||
|
$user = new User();
|
||||||
|
$user->setUsername($username);
|
||||||
|
$user->setPassword($this->passwordHasher->hashPassword($user, $plainPassword));
|
||||||
|
|
||||||
|
if ($input->getOption('admin')) {
|
||||||
|
$user->setRoles(['ROLE_ADMIN']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->em->persist($user);
|
||||||
|
$this->em->flush();
|
||||||
|
|
||||||
|
$io->success(sprintf('User "%s" created%s.', $username, $input->getOption('admin') ? ' with ROLE_ADMIN' : ''));
|
||||||
|
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user