Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

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
Shell :: npm does not support Node.js v10.19.0 
Shell :: mac os terminal bash command not found 
Shell :: linux run command in loop 
Shell :: tar a folder with subfolders 
Shell :: Start / Restart / Stop Nginx Commands 
Shell :: clone mongodb database to local machine 
Shell :: obs download ubuntu 
Shell :: git commit no message 
Shell :: size of directory powershell 
Shell :: git remove all local commits 
Shell :: error failed to launch the browser process puppeteer 
Shell :: yarn: command not found 
Shell :: ifconfig not found ubuntu 
Shell :: live server nvim 
Shell :: cpu core command linux 
Shell :: install docker on centos 
Shell :: ufw enable 
Shell :: install nodemcu in arduino 
Shell :: Flutter plugin not installed; this adds Flutter specific functionality. windows 
Shell :: device manager windows 10 run 
Shell :: how to open epub files on linux 
Shell :: pop last commit git 
Shell :: shell for file in directory 
Shell :: install openjdk ubuntu 
Shell :: get mac address ubuntu 
Shell :: htaccess all requests goes to index.php 
Shell :: install vinagre ubuntu 
Shell :: download snap store for kali linux 
Shell :: timezone brasil postgresql 
Shell :: gpg generate key 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =