87 lines
1.9 KiB
Markdown
87 lines
1.9 KiB
Markdown
Environnement de développement Docker pour démarrer un nouveau projet Symfony5
|
|
==================================
|
|
|
|
On repart de 1_docker_ready, et la procédure d'installation s'adapte comme ceci:
|
|
|
|
# Adaptations de la procédure d'installation
|
|
|
|
## 1. se mettre sur la bonne branche
|
|
|
|
```bash
|
|
$ git co -b 1_docker_ready origin/1_docker_ready
|
|
```
|
|
|
|
## 2. builder le projet
|
|
|
|
```bash
|
|
$ docker-compose build
|
|
$ docker-compose up
|
|
.. 221001_test3_db_1 exited with code 1
|
|
```
|
|
|
|
## 3. parce que 'db' ne se lance pas:
|
|
|
|
```bash
|
|
$ docker-compose rm db
|
|
$ sudo rm -rf ./data
|
|
$ docker-compose up db
|
|
```
|
|
|
|
## 4. entrer dans php
|
|
|
|
```bash
|
|
$ docker-compose exec -u 1000 php bash
|
|
```
|
|
|
|
## 5. create project
|
|
|
|
```bash
|
|
$ symfony new tadaam
|
|
$ mv tadaam/* . && mv tadaam/.* . && rmdir tadaam
|
|
```
|
|
|
|
## 6. composer require la base
|
|
|
|
```bash
|
|
$ composer require doctrine/annotations twig/twig doctrine/orm symfony/orm-pack symfony/form symfony/maker-bundle symfony/security-csrf
|
|
```
|
|
|
|
## 7. connexion postgresql
|
|
|
|
modifier DATABASE_URL dans app/.env :
|
|
```bash
|
|
+++ DATABASE_URL="postgresql://postgres:secret@db:5432/postgres?serverVersion=12&charset=utf8"
|
|
```
|
|
|
|
et dans le conteneur php :
|
|
```bash
|
|
$ bin/console doctrine:schema:create
|
|
```
|
|
|
|
## 8. composer require, la suite..
|
|
|
|
```bash
|
|
$ composer require symfony/yaml symfony/twig-bridge symfony/validator
|
|
|
|
$ composer require symfony/asset symfony/expression-language symfony/security-http symfony/translation symfony/web-link egulias/email-validator symfony/expression-language symfony/intl symfony/translation
|
|
|
|
$ composer require --dev symfony/profiler-pack symfony/debug-bundle symfony/var-dumper
|
|
```
|
|
|
|
## 9. Yarn
|
|
|
|
```bash
|
|
$ composer require symfony/webpack-encore-bundle
|
|
```
|
|
|
|
mettre en place le script qui lance docker node, le lancer pour entrer dans le conteneur node:
|
|
```bash
|
|
$ yarn install --force
|
|
$ yarn add sass sass-loader
|
|
$ yarn encore dev-server
|
|
```
|
|
|
|
## 10. c'est fait
|
|
|
|
le site est disponible sur http://localhost:8000
|