{"id":19065675,"url":"https://github.com/lerufic/laravel-docker","last_synced_at":"2025-09-07T11:31:15.584Z","repository":{"id":52469139,"uuid":"273669669","full_name":"LERUfic/laravel-docker","owner":"LERUfic","description":"Docker compose to setup nginx, php and mysql for laravel '7.16.1'.  ","archived":false,"fork":false,"pushed_at":"2021-04-28T06:52:04.000Z","size":113,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-09T00:52:56.800Z","etag":null,"topics":["docker","docker-compose","laravel","mysql","nginx","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LERUfic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-20T08:35:17.000Z","updated_at":"2024-02-07T09:12:42.000Z","dependencies_parsed_at":"2022-09-06T09:40:51.065Z","dependency_job_id":null,"html_url":"https://github.com/LERUfic/laravel-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LERUfic%2Flaravel-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LERUfic%2Flaravel-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LERUfic%2Flaravel-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LERUfic%2Flaravel-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LERUfic","download_url":"https://codeload.github.com/LERUfic/laravel-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232206388,"owners_count":18488512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","laravel","mysql","nginx","php"],"created_at":"2024-11-09T00:52:02.817Z","updated_at":"2025-01-02T14:15:30.561Z","avatar_url":"https://github.com/LERUfic.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dockerize Laravel\nDocker compose to setup nginx, php and mysql for laravel 7.16.1.  \n\n## Directory Structure\n```sh\nlaravel-docker\n├── docker\n│   ├── mysql\n│   │   └── based.sql\n│   ├── nginx\n│   │   └── nginx.conf\n│   └── php\n│       └── Dockerfile\n├── docker-compose.yml\n├── init-storage\n│   └── uploads\n└── reset-db.sh\n```\n## Images\n1. nginx → nginx:latest\n2. php → php:7.4-fpm\n3. mysql → mysql:5.7\n\n## Setup Initial DB\nYou can choose between using seeder or your own sql file for initial database.  \n### Using Seeder\n1. Open file *docker/php/Dockerfile* and uncomment lines 30-32\n    ```yaml\n    Before:\n    30 # RUN php artisan migrate:reset\n    31 # RUN php artisan migrate\n    32 # RUN php artisan db:seed\n\n    After:\n    30 RUN php artisan migrate:reset\n    31 RUN php artisan migrate\n    32 RUN php artisan db:seed\n    ```\n2. Open file *docker-compose.yml* and comment line 11\n    ```yaml\n    Before:\n    11 - ./docker/mysql/based.sql:/docker-entrypoint-initdb.d/based.sql\n\n    After:\n    11 # - ./docker/mysql/based.sql:/docker-entrypoint-initdb.d/based.sql\n    ```\n### Using SQL File\n1. Make sure lines 30-32 in file *docker/php/Dockerfile* are commented\n    ```yaml\n    30 # RUN php artisan migrate:reset\n    31 # RUN php artisan migrate\n    32 # RUN php artisan db:seed\n    ```\n2. Make sure line 11 in file *docker-compose.yml* is uncommented\n    ```yaml\n    11 - ./docker/mysql/based.sql:/docker-entrypoint-initdb.d/based.sql\n    ```\n3. Copy your sql file to *docker/mysql* with *based.sql* as a file name.  \n\n## Setup Initial storage\nIn this deployment we use command *php artisan storage:link* to connect public directory with storage directory.  \n```yaml\nSince:\n    public/storage → storage/app/public\nTherefore:\n    public/storage/uploads ≍ storage/app/public/uploads\n```\nTo setup initial files for storage directory just paste your file into *init-storage/uploads* and Dockerfile will copy those file when creating php image.\n\n## Deployment using Docker\n1. Deploy nginx, php-fpm, and mysql using docker-compose\n    ```bash\n    docker-compose up -d\n    ```\n2. Stop all container\n    ```bash\n    docker stop leru_nginx leru_mysql leru_php_fpm\n    ```\n3. Remove all container\n    ```bash\n    docker rm leru_nginx leru_mysql leru_php_fpm\n    ```\n4. Remove php-fpm image\n    ```bash\n    docker rmi laravel-docker_php_fpm\n    ```\n5. Reset mysql data\n    ```bash\n    bash reset-db.sh\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flerufic%2Flaravel-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flerufic%2Flaravel-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flerufic%2Flaravel-docker/lists"}