Search
 
SCRIPT & CODE EXAMPLE
 

PHP

comment installer laravel avec docker

*mettre à jour l'OS
  sudo apt-get update
  apt full-upgrade

*cloner laravel dans un répertoire et se positionner
	cd ~
    git clone https://github.com/laravel/laravel.git laravel-app
	cd ~/laravel-app

*créer les répertoires
	docker run --rm -v $(pwd):/app composer install
	'si erreur': sudo apt install docker.io
	'définir les autorisations': sudo chown -R $USER:$USER ~/laravel-app

*création et édition du docker-compose.yml
	nano ~/laravel-app/docker-compose.yml
	
                version: '3'
            services:

              #PHP Service
              app:
                build:
                  context: .
                  dockerfile: Dockerfile
                image: e-real.fr/php
                container_name: app
                restart: unless-stopped
                tty: true
                environment:
                  SERVICE_NAME: app
                  SERVICE_TAGS: dev
                working_dir: /var/www
                volumes:
                  - ./:/var/www
                  - ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
                networks:
                  - app-network

              #Nginx Service
              webserver:
                image: nginx:alpine
                container_name: webserver
                restart: unless-stopped
                tty: true
                ports:
                  - "80:80"
                  - "443:443"
                volumes:
                  - ./:/var/www
                  - ./nginx/conf.d/:/etc/nginx/conf.d/
                networks:
                  - app-network

              #MySQL Service
              db:
                image: mysql:5.7.22
                container_name: db
                restart: unless-stopped
                tty: true
                ports:
                  - "3306:3306"
                environment:
                  MYSQL_DATABASE: laravel
                  MYSQL_ROOT_PASSWORD: your_mysql_root_password
                  SERVICE_TAGS: dev
                  SERVICE_NAME: mysql
                volumes:
                  - dbdata:/var/lib/mysql/
                  - ./mysql/my.cnf:/etc/mysql/my.cnf
                networks:
                  - app-network

            #Docker Networks
            networks:
              app-network:
                driver: bridge
            #Volumes
            volumes:
              dbdata:
                driver: local
                
 *fichier image docker
 	nano ~/laravel-app/Dockerfile
 *créer le fichier local.ini dans le dossier php.
 	 mkdir ~/laravel-app/php
	 nano ~/laravel-app/php/local.ini 'upload_max_filesize=40M
										post_max_size=40M'
*config de nginx
	mkdir -p ~/laravel-app/nginx/conf.d
	nano ~/laravel-app/nginx/conf.d/app.conf

	server {
    listen 80;
    index index.php index.html;
    error_log  /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /var/www/public;
    location ~ .php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass app:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
      }
      location / {
          try_files $uri $uri/ /index.php?$query_string;
          gzip_static on;
      }
  }

*config mysql
	
  mkdir ~/laravel-app/mysql
  nano ~/laravel-app/mysql/my.cnf

	[mysqld]
    general_log = 1
    general_log_file = /var/lib/mysql/general.log

*Exécution des conteneurs et modification des paramètres
	cp .env.example .env
	docker-compose up -d

*conteneurs en cours
	docker ps
*exec des commandes specifiques dans les conteneurs
	docker-compose exec app vim .env
Comment

PREVIOUS NEXT
Code Example
Php :: laravel eloquent difference create and insert 
Php :: how to hide submenu admin wordpress 
Php :: pass variable to blade laravel 
Php :: how to append an array into associative array 
Php :: cakephp 3 make migration 
Php :: wamp php version update 
Php :: php fn closure 
Php :: indexing in database laravel 
Php :: laravel, if -get() array is not emtpy 
Php :: In PackageManifest.phpIn PackageManifest.php line 122: Undefined index: name line 122: Undefined index: name 
Php :: template engine php 
Php :: laravel backpack 
Php :: php spreadsheet styles 
Php :: php string concatenation 
Php :: create table laravel give name table 
Php :: laravel run function after forgot password 
Php :: notification in laravel 8 
Php :: laravel permission create role 
Php :: create trait in laravel 8 
Php :: laravel eloquent batch insert 
Php :: Comment définir un délimiteur de fil d’Ariane personnalisé dans WooCommerce 
Php :: ezSql PDO Connection 
Php :: yii2 rollback last migration 
Php :: php check if variable is resource 
Php :: Woofood Availability checker 
Php :: how to get session variables from cookie string 
Php :: Laravel FileManager Display Blank pop up page 
Php :: clear laravel cache and clear vue 
Php :: filter elementor 
Php :: Uncaught TypeError: call_user_func(): Argument #1 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =