Merge pull request #14 from arifszn/sail

feat: dockerize hydra using sail
pull/16/head
Hasin Hayder 2 years ago committed by GitHub
commit 9c2ab6ce1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,38 +43,76 @@ Hydra is a zero-config API boilerplate with Laravel Sanctum and comes with excel
It's super easy to get Hydra up and running.
1. clone the project
First clone the project and change the directory
```shell
git clone https://github.com/hasinhayder/hydra.git
cd hydra
```
2. install the dependencies
Then follow the process using either Docker or without Docker.
### Using Docker
1. install the dependencies
```shell
cd hydra
composer install
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php81-composer:latest \
composer install --ignore-platform-reqs
```
3. Copy `.env.example` to `.env`
2. Copy `.env.example` to `.env`
```shell
cp .env.example .env
```
3. Run the containers
```shell
./vendor/bin/sail up
```
4. Generate application key
```shell
./vendor/bin/sail artisan key:generate
```
To learn more about Sail, visit the [official Doc](https://laravel.com/docs/9.x/sail).
### Without Docker
1. install the dependencies
```shell
composer install
```
2. Copy `.env.example` to `.env`
```shell
cp .env.example .env
```
3. Generate application key
```shell
php artisan key:generate
```
5. Start the webserver
4. Start the webserver
```shell
php artisan serve
```
That's mostly it! You have a fully running laravel installation with Sanctum, all configured.
That's mostly it! You have a fully running laravel installation with Sanctum, all configured.
### Screencast

@ -16,7 +16,7 @@
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"laravel/sail": "^1.14",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",

@ -0,0 +1,94 @@
# For more information: https://laravel.com/docs/sail
version: '3'
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.1
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.1/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
- '${HMR_PORT:-8080}:8080'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
- redis
- minio
mysql:
image: 'mysql/mysql-server:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'sail-mysql:/var/lib/mysql'
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
retries: 3
timeout: 5s
redis:
image: 'redis:alpine'
ports:
- '${FORWARD_REDIS_PORT:-6379}:6379'
volumes:
- 'sail-redis:/data'
networks:
- sail
healthcheck:
test: ["CMD", "redis-cli", "ping"]
retries: 3
timeout: 5s
minio:
image: 'minio/minio:latest'
ports:
- '${FORWARD_MINIO_PORT:-9000}:9000'
- '${FORWARD_MINIO_CONSOLE_PORT:-8900}:8900'
environment:
MINIO_ROOT_USER: 'sail'
MINIO_ROOT_PASSWORD: 'password'
volumes:
- 'sail-minio:/data/minio'
networks:
- sail
command: minio server /data/minio --console-address ":8900"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
retries: 3
timeout: 5s
mailhog:
image: 'mailhog/mailhog:latest'
ports:
- '${FORWARD_MAILHOG_PORT:-1025}:1025'
- '${FORWARD_MAILHOG_DASHBOARD_PORT:-8025}:8025'
networks:
- sail
networks:
sail:
driver: bridge
volumes:
sail-mysql:
driver: local
sail-redis:
driver: local
sail-minio:
driver: local
Loading…
Cancel
Save