Code Monkey home page Code Monkey logo

docker-compose-template-laravel's Introduction

docker-compose-template-laravel

simple docker-compose templates for Laravel, Node.js frontend(example Vue.js) and Swagger.

this use prefer officeal last images.

Linux, OSX amd Windows firiendly.

Require

  • Docker

Setup

  1. Build Docker container

    git clone [email protected]:m2wasabi/docker-compose-templates.git
    

    if you use different config (minimal usage) try another branches.

  2. Clone youe project

    git clone [email protected]:<your account>/<your Laravel project>.git app
    

    and Additional side project (if needed)

    git clone [email protected]:<your account>/<your Vue.js project>.git node
    git clone [email protected]:<your account>/<your Swagger project>.git swagger
    

    or new blank project

    mkdir -p app/public
    
  3. Configure containers

    Nginx

    docker-assets/nginx/conf.d/vhosts-main.conf

    • Comment or uncomment settings

    PHP

    docker-assets/php-fpm/Dockerfile

    • Configure php packages

    Node.js (Default disabled)

    docker-assets/node/scripts/bootstrap.sh

    • Configure entrypoint

    Docker compose

    docker-compose.yml

    • Comment or uncomment settings
  4. Build Docker container

    docker-compose build
    
  5. Start containers

    docker-compose up
    
  6. Join console to Setup

    Linux/OSX

    ./php.sh
    ./mysql.sh
    

    Windows

    .\php.bat
    .\mysql.bat
    

    then, enter php-fpm container

    /scripts/setup.sh
    

Usage

Boot comtainers

docker-compose up

Delete containers

docker-compose down

ContainerDelete command does NOT delete data and contents.

Using shell

PHP server

./php.sh

or

php.bat

Install Laravel (if new project)

composer global require laravel/installer

PATH=$PATH:$HOME/.composer/vendor/bin/
export PATH

laravel new

Laravel configure parameters

If you use redis install predis

composer require predis/predis

Edit .env file

DB_HOST=mysql
REDIS_HOST=redis

CACHE_DRIVER=redis
SESSION_DRIVER=redis
QUEUE_DRIVER=redis

Shell utility command for Laravel

  • Setup New Appplication

    /scripts/setup.sh
    
  • Update Application (migrate)

    /scripts/update.sh
    
  • Database clean and rebuild

    /scripts/db_reset.sh
    

MySQL Server

./mysql.sh

or

mysql.bat

Data files and endpoints

  • mysql_data/
    MySQL database storage
    If destroy this content, Docker re-create new database.

  • app/public
    Web publish files

  • node/server.js (Default Disabled)
    Node.js execute file as a web server

  • swagger (Default Disabled)
    Web publish files on http://localhost:8080/swagger/

docker-compose-template-laravel's People

Contributors

m2wasabi avatar

Watchers

 avatar  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.