Logo

dev-resources.site

for different kinds of informations.

Building Docker Container for a Laravel Project

Published at
6/24/2023
Categories
docker
laravel
beginners
devops
Author
Automata
Categories
4 categories in total
docker
open
laravel
open
beginners
open
devops
open
Building Docker Container for a Laravel Project

In the first place, we need a web server that can support someone specific php version.

  • Web server: nginx
  • Php version: php-7.4

When we need two containers. We will create a docker-composer.yml usign this structure.

# Main Directory
ā””ā”€ā”€ docker-laravel
    ā””ā”€ā”€ docker-compose.yml
    ā””ā”€ā”€ README.md
    ā””ā”€ā”€ phpfpm
        ā””ā”€ā”€ Dockerfile
    ā””ā”€ā”€ nginx
        ā””ā”€ā”€ default.conf
        ā””ā”€ā”€ Dockerfile
    ā””ā”€ā”€ laravel-project          # Laravel Project
        ā””ā”€ā”€ app.php
        ā””ā”€ā”€ ...
        ā””ā”€ā”€ composer.json

Or just we download it in a chosen location using following command:

git clone https://github.com/automatape/docker-laravel.git
cd docker-laravel

For create and start the container (in first plane)

docker-compose up

Featured ones: