{"id":22108607,"url":"https://github.com/vshloda/docker-laravel","last_synced_at":"2025-07-16T03:45:53.982Z","repository":{"id":220531617,"uuid":"447921834","full_name":"vshloda/docker-laravel","owner":"vshloda","description":"Docker configuration for laravel project ( Nginx, php, mysql, laravel )","archived":false,"fork":false,"pushed_at":"2025-02-20T09:35:46.000Z","size":14,"stargazers_count":46,"open_issues_count":1,"forks_count":23,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T04:41:55.772Z","etag":null,"topics":["docker","docker-compose","laravel","mysql","nginx","php8"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vshloda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-14T10:05:00.000Z","updated_at":"2025-03-18T15:19:44.000Z","dependencies_parsed_at":"2024-02-10T09:26:22.480Z","dependency_job_id":"023318d4-e426-4c39-b6fb-f4ee5c5fd4a0","html_url":"https://github.com/vshloda/docker-laravel","commit_stats":null,"previous_names":["vshloda/docker-laravel"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vshloda/docker-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vshloda%2Fdocker-laravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vshloda%2Fdocker-laravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vshloda%2Fdocker-laravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vshloda%2Fdocker-laravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vshloda","download_url":"https://codeload.github.com/vshloda/docker-laravel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vshloda%2Fdocker-laravel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265479844,"owners_count":23773625,"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","php8"],"created_at":"2024-12-01T09:16:41.208Z","updated_at":"2025-07-16T03:45:53.948Z","avatar_url":"https://github.com/vshloda.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Environment Setup for the Latest Version of Laravel (PHP, Nginx, Laravel, MySql) Using Docker\n\n### Project Structure\n\n- `docker` - Folder for all configuration files for docker and other services\n    - `nginx` - Folder for nginx configuration files\n    - `php` - Folder for php configuration files\n- `src` - Folder where the project code will be stored\n- `docker-compose.yml` - Docker compose configuration file\n\n### Step-by-Step Guide\n\n#### 1. Environment Setup\n\n- Remove empty files from src and mysql dirs.\n\n  ```\n  rm src/empty\n  rm mysql/empty\n  ```\n\n- In docker-compose.yml, change the data to access the database\n\n  ```\n  MYSQL_DATABASE: laraveldb\n  MYSQL_USER: laravel\n  MYSQL_PASSWORD: secret\n  MYSQL_ROOT_PASSWORD: secret\n  ```\n\n#### 2. Build the Project Using Docker Compose\n\n- Run this command\n  \n  ```\n  docker compose build\n  ```\n\n#### 3. Create a Laravel Project\n\n-  Run this command:\n\n  ```\n  docker compose run --rm composer create-project laravel/laravel .\n  ```\n\n- After running this command, the project code should appear in the src folder.\n\n- Start docker containers\n\n  ```\n  docker compose up -d\n  ```\n\n- You can verify if the project is working by opening the browser. For example, if it’s set to 80:\n\n  ```\n  http://localhost\n  ```\n\n#### 4. Configure Laravel project \n \n- Configure Mysql in /src/.env . Uncomment and change:\n\n  ```\n  DB_CONNECTION=mysql       # connection name, we use mysql\n  DB_HOST=mysql             # name of mysql service in docker-compose.yml\n  DB_PORT=3306              # mysql standart port \n  DB_DATABASE=laraveldb     # database name from MYSQL_DATABASE in docker-compose.yml\n  DB_USERNAME=laravel       # username from MYSQL_USER in docker-compose.yml\n  DB_PASSWORD=secret        # user password from MYSQL_PASSWORD in docker-compose.yml\n  ```\n- Restart all services\n  \n  ```\n  docker compose down\n  docker compose up -d\n  ```\n\n#### 5. Run Migrations\n\n  ```\n  docker compose run --rm artisan migrate\n  ```\n\n#### Some useful commands\n\n- Enter the php container (php is the name of the service from docker-compose.yml)\n\n  ```\n  docker compose run --rm php /bin/sh\n  ```\n\n- If access Forbidden\n\n  ```\n  docker compose run --rm php /bin/sh\n  chown -R laravel:laravel /var/www/html\n  ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvshloda%2Fdocker-laravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvshloda%2Fdocker-laravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvshloda%2Fdocker-laravel/lists"}