Skip to content

s22su/laravel-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel + Docker + PHP 7.3 (with composer) + PostgreSQL starter pack

This is a starter pack to start developing your next $1 Billion app using Laravel in just a few minutes.

This starter pack is also suitable for any other PHP project/framework.

Starter pack includes:

  • nginx
  • PHP 7.3
  • Composer
  • PostgreSQL 12
  • Laravel starter code

Getting started

Prerequisites

Having docker and docker-compose installed.

If you are not familiar with docker then check out Set up your Docker environment article from Docker's official web site.

If you don't have docker-compose installed then check out the installation guide from official web site.

Installation

  1. Clone the project and bring the containers up:
    git clone laravel-docker-starter-pack && cd laravel-docker-starter-pack
    docker-compose up
  2. install composer packages:
    docker-compose exec -w /var/www/html php composer install
  3. Navigate to http://localhost:8080
  4. Done!

Connecting to Postgres

Database created by default and that should be used for your application is app. Username is docker and password is secret.

To connect to postgres DB from php application use db as a host name and default port (5432).

To connect from the host machine use localhost as the host name and port 54321.

PS! Default Laravel code that comes with the starter pack has everything already configured.

Running artisan commands (ex. migrations)

docker-compose exec -w /var/www/html php php artisan <command>

License

This project is licensed under the MIT License - see the LICENSE.md file for details.