Giter VIP home page Giter VIP logo

docker-symfony's Introduction

PHP symfony environment

This is a complete stack for running Symfony 4 into Docker containers using docker-compose tool.

Installation

First, clone this repository:

$ git clone https://github.com/e-zack/docker-symfony.git

Let’s start Docker !

$ docker-compose build

Then, run:

$ docker-compose up -d

How Docker work ?

I will not explain how Docker because this is not the subject, but for keep going this post you have to understand two things :

  • Each container is one linux distribution with one component
  • Each container have one root access by default

So when you execute this :

$ docker exec -it sf4_mysql bash

You are right now in the mysql container as root user. You can explorer this container as you want ;)

Symfony here we are

Now we know how use Docker, so let’s go to the PHP one and not as root, but as user : dev

$ docker exec -it -u dev sf4_php bash

Now you are inside the php container with dev user and we have to get Symfony. Just to test, launch a php -v in this container. ;)

So let’s go to your home :

cd /home/wwwroot/sf4

Installation of Symfony4 with composer

$ composer create-project symfony/skeleton temp-folder ^4.4

or : for last version of Symfony

$ composer create-project symfony/skeleton temp-folder 

When it’s done, we will get the project to the root path.

$ cp -Rf /home/wwwroot/sf4/temp-folder/. .
$ rm -Rf /home/wwwroot/sf4/temp-folder

Launch in your browser :

http://localhost

Congratulation !! You can now easily start your new Symfony project. If you look inside the docker-compose.yml file you can see all acces as you need, for example the mysql access :

MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: sf4
MYSQL_USER: sf4
MYSQL_PASSWORD: sf4

docker-symfony's People

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.