Skip to content
/ laradock Public

🐳 A customizable Laravel development environment using Docker Compose with PHP-FPM and Nginx, offering flexibility to adjust PHP versions, Nginx settings, and any dependencies for your app's needs.

License

Notifications You must be signed in to change notification settings

fyvri/laradock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

laradock

To create a simple Laravel development environment using Docker Compose, which runs PHP-FPM and Nginx, and offers high flexibility for customization to suit your project's specific needs.

laradock

laradock, a Docker-based solution, offers a range of configuration options that allow you to easily extend and modify the default environment. By adjusting the provided scripts and configuration files, you can fine-tune the environment to meet the requirements of your application.

Here are several examples of how you can customize the default environment to better suit your needs:

  • Choose any desired port for the application, enabling you to tailor the environment to your network setup.
  • Select any PHP version from the official PHP image repository, giving you the flexibility to work with the PHP version most suitable for your app.
  • Add additional packages such as bash, yarn, or others to enhance the development environment with more tools that might be needed for your workflow.
  • Install custom PHP extensions or tools to meet the specific requirements of your application.
  • Modify Nginx configurations to adapt the web server's behavior to the specific needs of your Laravel app, such as adjusting rewrite rules or configuring SSL.

For more detailed guidance on how to customize the Docker setup, refer to the following documentation files:

By referencing these resources, you can easily configure the development environment to match your precise needs, ensuring a streamlined and efficient Laravel development experience.


Important

New features will be added over time! Right now, it ONLY supports Linux, but I’d love to expand it to macOS too. If you’re interested in helping it grow, your support could even help me save up for a MacBook πŸ’» to make that happen β€” but only if you’re definitely able to! 😊 πŸŽ‰

Saweria Β  Trakteer Β  Ko-fi Β  PayPal

πŸ› οΈ Installation

  1. Clone this repository:

    git clone git@github.com:fyvri/laradock.git && cd laradock
  2. Make the script executable:

    chmod +x ./laradock.sh

🍻 Setup

Before running laradock, make sure that you have installed Docker and are able to execute the docker compose command in your terminal.

  • App Directories

    All of your app directories should be placed under the src/ directory. This directory contains the collection of your Laravel apps, which will be installed and managed via laradock. For comprehensive guidance on how to accomplish this, please refer to the detailed steps provided here.

  • App Image

    The app image serves as the core environment for running your Laravel application and is built upon the php:${version}-fpm-alpine image. By default, the app image will install the following packages:

    • composer
    • curl
    • freetype-dev
    • libjpeg-turbo-dev
    • libzip-dev

    Additionally, the app image will install several PHP extensions by default, including:

    • bcmath
    • gd
    • mbstring
    • opcache
    • pdo_mysql
    • zip

    However, you have the flexibility to customize the image by adding any extra packages or dependencies that your app requires. You can do this by creating custom scripts in the compose/app/scripts/ directory. For detailed instructions on how to achieve this, please follow the steps outlined here.

  • Web Image

    The web image is based on the nginx:stable-alpine image. It comes pre-configured to run Nginx and apply the necessary configurations for your app. However, if you need to add extra packages or replace the default Nginx configuration, you are free to modify it. To learn how to customize the web image, refer to the instructions provided here.

πŸš€ Usage

  • Basic

    Simply, laradock can be run with:

    ./laradock.sh compose
  • Advanced

    ./laradock.sh compose -n laradock -p 1337 -i laravel-10.x --php 8.1 --dev

🚩 Flags

This will display help for the tool. Here are all the options it supports.

                                 🐳 v0.0.1
______                 ____________          ______
___  /_____ _____________ ______  /_____________  /__
__  /_  __ '/_  ___/  __ '/  __  /  __ \  ___/_  //_/
_  / / /_/ /_  /   / /_/ // /_/ // /_/ / /__ _  ,<
/_/  \__^_/ /_/    \__^_/ \__,_/ \____/\___/ /_/|_|

Usage:
   ./laradock.sh [command] [options...] <value> [--dev]

Commands:
   compose       : Compose πŸš€
   help          : Show this help message πŸ“–

Options:
   -n, --name    : Set the image name
   -p, --port    : Set the app port (default: 8000)
   -i, --input   : Set the app directory name (e.g., awesome-laravel)
       --php     : Specify the PHP version (e.g., 5.6, 7.4, 8.1, etc)
       --dev     : Build image on development

Examples:
   ./laradock.sh compose
   ./laradock.sh compose -n laravel-5.8 -p 8000 -i laravel-5.8 --php 7.2
   ./laradock.sh compose -n laravel-9.x -p 8000 -i laravel-9.x --php 8.0 --dev

πŸ‘₯ Contribution

If you have any ideas, open an issue and tell me what you think.

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

Warning

If you have a suggestion that would make this better, please fork the repo and create a pull request. Don't forget to give the project a star 🌟 I can't stop saying thank you!

  1. Fork this project
  2. Create your feature branch (git checkout -b feature/awesome-feature)
  3. Commit your changes (git commit -m "feat: add awesome feature")
  4. Push to the branch (git push origin feature/awesome-feature)
  5. Open a pull request

πŸ“œ License

This project is licensed under the MIT License. Feel free to use and modify it as needed.

About

🐳 A customizable Laravel development environment using Docker Compose with PHP-FPM and Nginx, offering flexibility to adjust PHP versions, Nginx settings, and any dependencies for your app's needs.

Resources

License

Stars

Watchers

Forks