Versión 1/4 - Siguiente » - Versión actual
Guillermo Zdanowicz, 04/01/2019 10:54


Configurar Laravel con Mysql en Docker

INSTALO DOCKER PARA MYSQL
docker run --name automysql -v /home/backup/bdmysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root911 -d mysql:5.7

INSTALO DOCKER PARA NGINX VINCULANDO MYSQL
docker run --name autodocker -d --link automysql:mysql -p 8080:80 -v "/home/projects/autogestion:/var/www/app:rw" --restart=always romeoz/docker-nginx-php:7.2

VERIFICO DOCKERS INSTALADOS
sudo docker ps -a

PARO DOCKER
docker stop autodocker

ELIMINO DOCKER
docker rm autodocker

INICIO DOCKER
docker start autodocker

EN SERVIDOR LOCAL BAJAR POR EJEMPLO EN /home/projects el codigo del repositorio

BAJO DEL REPOSITORIO EL CODIGO
git clone (link repositorio en este caso de llama autogestion la carpeta)

docker run --name autodocker -d --link automysql:mysql -p 8080:80 -v "/home/projects/autogestion:/var/www/html:rw" --restart=always romeoz/docker-nginx-php:7.2

//INGRESO AL DOCKER DEL NGINX
docker exec -ti autodocker bash

INGRESO A LA CARPETA DEL SITIO
/var/www/app

ACTUALIZAMOS COMPOSER
composer update

CORRO SENTENCIA INICIAL DE LARAVEL
php artisan key:generate

----------------------------------------------
DENTRO DEL autodocker CONFIGURAR EL ARCHIVO /etc/nginx/conf.d/default.conf

/etc/nginx/conf.d/default.conf [----] 0 L:[ 1+23 24/ 80] 0010 0x00A [][X]

server {
listen 80;
server_name localhost;

root /var/www/app/public;
index index.php;
charset utf8;
location /assets/
{
location ~ \.(?:js|json|ts|css|scss|woff(?:2)?|ttf|map|ico|html|xml|swf|flv|pdf|xls|htc|svg|gif|jpg|png|jpeg)$ {
log_not_found off;
expires 90d;
gzip on;
gzip_static on;
gzip_http_version 1.1;
gzip_comp_level 8;
gzip_types text/plain text/css application/x-javascript text/javascript;
}
return 404;
}
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location /
{
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$
{
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}

}

Redmine Appliance - Powered by TurnKey Linux