From 663c2e5ae9b34bc75e3645c81ef64ab629382c0f Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Wed, 27 Jul 2022 12:35:21 +0100 Subject: [PATCH] Get sail working --- composer.json | 1 + composer.lock | 62 ++++++++++++++++++++++++++++++++++++++++++- docker-compose.yml | 65 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml diff --git a/composer.json b/composer.json index 5158b17e..493d331c 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,7 @@ "fakerphp/faker": "^1.9.2", "laravel/dusk": "^6.0", "laravel/pint": "^1.0.0", + "laravel/sail": "^1.15", "mockery/mockery": "^1.0", "nunomaduro/collision": "^6.1", "phpunit/php-code-coverage": "^9.2", diff --git a/composer.lock b/composer.lock index 80bcd162..d952090d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c152af902b24084f8a8b69201651179f", + "content-hash": "0661a04d55cb19d1416d1ce0c1c005cb", "packages": [ { "name": "aws/aws-crt-php", @@ -8894,6 +8894,66 @@ }, "time": "2022-07-14T14:50:04+00:00" }, + { + "name": "laravel/sail", + "version": "v1.15.1", + "source": { + "type": "git", + "url": "https://github.com/laravel/sail.git", + "reference": "2fe64c0b45a3af56cac0af638c8020a8adc860d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/sail/zipball/2fe64c0b45a3af56cac0af638c8020a8adc860d7", + "reference": "2fe64c0b45a3af56cac0af638c8020a8adc860d7", + "shasum": "" + }, + "require": { + "illuminate/console": "^8.0|^9.0", + "illuminate/contracts": "^8.0|^9.0", + "illuminate/support": "^8.0|^9.0", + "php": "^7.3|^8.0" + }, + "bin": [ + "bin/sail" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "laravel": { + "providers": [ + "Laravel\\Sail\\SailServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Sail\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Docker files for running a basic Laravel application.", + "keywords": [ + "docker", + "laravel" + ], + "support": { + "issues": "https://github.com/laravel/sail/issues", + "source": "https://github.com/laravel/sail" + }, + "time": "2022-07-21T14:33:56+00:00" + }, { "name": "maximebf/debugbar", "version": "v1.18.0", diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..4910c42f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,65 @@ +# 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' + - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' + 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: + - pgsql + - redis + pgsql: + image: 'postgres:14' + ports: + - '${FORWARD_DB_PORT:-5432}:5432' + environment: + PGPASSWORD: '${DB_PASSWORD:-secret}' + POSTGRES_DB: '${DB_DATABASE}' + POSTGRES_USER: '${DB_USERNAME}' + POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}' + volumes: + - 'sail-pgsql:/var/lib/postgresql/data' + - './vendor/laravel/sail/database/pgsql/create-testing-database.sql:/docker-entrypoint-initdb.d/10-create-testing-database.sql' + networks: + - sail + healthcheck: + test: ["CMD", "pg_isready", "-q", "-d", "${DB_DATABASE}", "-U", "${DB_USERNAME}"] + 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 +networks: + sail: + driver: bridge +volumes: + sail-pgsql: + driver: local + sail-redis: + driver: local