Giter Club home page Giter Club logo

docker-symfony's Introduction

Docker Symfony

C'est un projet qui permet de lancer un container afin d'installer le framework Symfony comme moi je l'entends.
Quand moi j'installe Symfony, j'installe Symfony + une base de donnée, c'est tout.
Je n'installe pas tout ce qui est Traefik, mailer, tartanpion. Je le fais uniquement si j'en ai besoin.
C'est comme ça aussi que j'arrive le mieux à comprendre les évolutions technologiques et les choix qui ont été fait

Pré-requis:

  • Docker: Lien d'installation
  • Créer votre fichier .env avec le fichier d'exemple .env.exemple à la racine.

Installation

Build le projet et attendre un moment:

docker-compose build --pull --no-cache

Et quand c'est fini:

docker compose up -d

Se rendre dans le container avec la commande ci-dessous pour créer un projet

docker exec -it server bash (si vous avez bash)
ou
docker exec -it server /bin/sh

TOUT SE FAIT DEPUIS CE CONTAINER MAINTENANT
OU
UTILISER LE DOCKER DESKTOP


Créer son projet

  • From scratch:

    symfony new .

  • Projet existant:
    git clone https://github.com/xxxxx/xxxx-xxxx .
    composer install

Installer ORM

Le pack ORM a son propre docker du coup, il s'installe dans un second temps. À la question, si je veux mettre le projet sous docker, moi je met "non", il est déjà sous docker.

composer require symfony/orm-pack

Do you want to include Docker configuration from recipes?
[y] Yes
[n] No
[p] Yes permanently, never ask again for this project
[x] No permanently, never ask again for this project
(defaults to y): n

Utilisation

Avant d'utiliser symfony, n'oublie pas d'aller dans le /project/.env afin de modifier l'url de connexion à la base de donnée.

Mysql:

Changer ceci:
DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8&charset=utf8mb4"    
en:
DATABASE_URL="mysql://[MYSQL_USER]:[MYSQL_ROOT_PASSWORD]@[NOM DU SERVICE DOCKER]:3306/[MYSQL_DATABASE]?serverVersion=8&charset=utf8mb4"
(replacer les variables)

Postgres:

DATABASE_URL="postgresql://[POSTGRES_USER]:[POSTGRES_PASSWORD]@[NOM DU SERVICE DOCKER]:5432/[POSTGRES_DATABSE]?serverVersion=14&charset=utf8"

symfony server:start    

GitHub

Rappel: configurer votre git si ce n'est pas encore fait

git config --global user.email "[email protected]"
git config --global user.name "xxxxxx"

Créer votre repository sur github. (Attention, il doit être complement vide)
Puis, depuis votre terminal:

git remote add origin https://<ACCESS_TOKEN>@github.com/username/nom-du-repo
git branch -M main
git push -u origin main

Commande utile:

  • Créer une branche depuis une autre: git checkout -b future_branche ancienne_branche

docker-symfony's People

Contributors

samakunchan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.