Awesome
docker-laravel š³
<p align="center"> <img src="https://user-images.githubusercontent.com/35098175/145682384-0f531ede-96e0-44c3-a35e-32494bd9af42.png" alt="docker-laravel"> </p> <p align="center"> <img src="https://github.com/ucan-lab/docker-laravel/actions/workflows/laravel-create-project.yaml/badge.svg" alt="Test laravel-create-project.yml"> <img src="https://github.com/ucan-lab/docker-laravel/actions/workflows/laravel-git-clone.yaml/badge.svg" alt="Test laravel-git-clone.yml"> <img src="https://img.shields.io/github/license/ucan-lab/docker-laravel" alt="License"> </p>Introduction
Build a simple laravel development environment with Docker Compose. Support with Windows(WSL2), macOS(Intel and Apple Silicon) and Linux.
Usage
Create an initial Laravel project
- Click Use this template
- Git clone & change directory
- Execute the following command
$ task for-linux-env # Linux environment only
$ task create-project
# or...
$ make for-linux-env # Linux environment only
$ make create-project
# or...
$ echo "UID=$(id -u)" >> .env # Linux environment only
$ echo "GID=$(id -g)" >> .env # Linux environment only
$ mkdir -p src
$ docker compose build
$ docker compose up -d
$ docker compose exec app composer create-project --prefer-dist laravel/laravel .
$ docker compose exec app php artisan key:generate
$ docker compose exec app php artisan storage:link
$ docker compose exec app chmod -R 777 storage bootstrap/cache
$ docker compose exec app php artisan migrate
Create an existing Laravel project
- Git clone & change directory
- Execute the following command
$ task for-linux-env # Linux environment only
$ task install
# or...
$ make for-linux-env # Linux environment only
$ make install
# or...
$ echo "UID=$(id -u)" >> .env # Linux environment only
$ echo "GID=$(id -g)" >> .env # Linux environment only
$ docker compose build
$ docker compose up -d
$ docker compose exec app composer install
$ docker compose exec app cp .env.example .env
$ docker compose exec app php artisan key:generate
$ docker compose exec app php artisan storage:link
$ docker compose exec app chmod -R 777 storage bootstrap/cache
Tips
Container structures
āāā app
āāā web
āāā db
app container
web container
- Base image
- nginx:1.26
db container
- Base image
- mysql:8.4
mailpit container
- Base image