Code Monkey home page Code Monkey logo

docker-template's Introduction

Lite Docker environment for local development with Laravel

Containers

  • PHP (+ composer)
  • Nginx
  • MySQL
  • NPM (disposable|removable)

Setup

  1. Clone repository

  2. Go to folder with cloned repository.

  3. Run docker-compose up -d --build

  4. Remove README.md file from ./src folder and place your code to ./src folder

    4.1. With git

    • git clone https://github.com/user/repo.git ./src
    • docker-compose exec app composer install

    4.2. Create new project with composer

    • docker-compose exec app composer create-project laravel/laravel ./
  5. Setup database connection in your .env file:

         DB_CONNECTION=mysql
      
         DB_HOST=mysql
      
         DB_PORT=3306
      
         DB_DATABASE=laravel
      
         DB_USERNAME=laravel
      
         DB_PASSWORD=secret
    
  6. Run migrations: docker-compose exec app php artisan migrate

Now your application available by http://localhost:8080

Available commands

Composer

docker-compose exec app composer [composer_command]

PHP and artisan

docker-compose exec app php [options] [-f] <file> [--] [args...]

docker-compose exec app php artisan [artisan_command]

npm

Container is created to execute a npm command and will be removed after command execution.

docker-compose run -rm npm install

docker-compose run -rm npm run dev

docker-compose run -rm npm run watch-poll

Volumes

Named volumes are used here. Physically located in /var/lib/docker/volumes/. Available to users with sudo rights.

  • volumes list - docker volume ls
  • inspect volume - docker volume inspect test_mysqldbvolume

docker-template's People

Contributors

vosaan avatar volosan avatar

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.