Giter Site home page Giter Site logo

docker-laravel-project-template's Introduction

Docker Laravel Project Template

This is simple project template for developing Laravel and Lumen webapps with Docker. You just need Docker and IDE like Visual Studio Code to start developing.

Start develop Laravel/Lumen App

Get Docker: https://docs.docker.com/get-docker/

Download the latest release and extract it.

Copy .env.example to .env.

Start with docker-compose Nginx, PHP-FPM, Minio (S3-compatible file storage for persistent files) and Phpmyadmin. To use apache-version, uncomment Apache instead, edit Dockerfile.dev and Dockerfile.

docker-compose up -d

Install Laravel

Create new Laravel project and install to ./app directory.

docker-compose exec laravel composer create-project laravel/laravel .

Copy app/.env and app/.env.example to project root. Change the DB_HOST variable to db.

Restart the laravel container

docker-compose restart laravel

Now have fun start develop your own app.

More instructions

Install Lumen

Create new Lumen project and install to ./app directory.

docker-compose exec laravel composer create-project --prefer-dist laravel/lumen .

Copy app/.env and app/.env.example to project root. Change the DB_HOST variable to db.

Restart the laravel container

docker-compose restart laravel

Now have fun start develop your own app.

More instructions

Move exist Laravel/Lumen project to container

If you have exist Laravel/Lumen project, just create app directory and place Laravel installation in created directory.

Move then .env and .env.example to project root and change DB_HOST variable to db. If you have exist database, export it and save it to sql directory so it will be automatically imported when container startup.

Deploy to production

Build your production image. Change youraccount/project_name to your own Docker Hub account name and project name you like to use.

docker build -t youraccount/project_name .

Upload your image to Docker Hub or some other container repository.

Docker Swarm

Here is example stack template to build to Docker Swarm.

version: '3.8'
services:
  laravel:
    image: youraccount/project_name
    ports:
    - 80:80
    environments:
      DB_HOST: db
      DB_DATABASE: laravel
      DB_USERNAME: laravel
      DB_PASSWORD: laravel
      # And other environment variables

License

MIT

docker-laravel-project-template's People

Contributors

olkitu avatar

Stargazers

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