diff --git a/.env.example b/.env.example index c2ae1b5..cd95b7f 100644 --- a/.env.example +++ b/.env.example @@ -4,6 +4,14 @@ APP_KEY= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost +SAIL_VERSION=8.2 + +APP_OFFLINE=0 +APP_PORT=8180 +APP_SERVICE=mensa.php +WWWUSER=1000 +WWWGROUP=1000 +FORWARD_DB_PORT=3307 DB_CONNECTION=mysql DB_HOST=127.0.0.1 @@ -11,6 +19,7 @@ DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret +DB_ROOT_PASSWORD=verysecret BROADCAST_DRIVER=log CACHE_DRIVER=file @@ -73,4 +82,4 @@ ADLDAP_ADMIN_USERNAME= ADLDAP_ADMIN_PASSWORD= ADLDAP_CONTROLLERS= ADLDAP_PORT= -ADLDAP_BASEDN= \ No newline at end of file +ADLDAP_BASEDN= diff --git a/composer.json b/composer.json index 69b81e5..b1ba78e 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ "laravel/ui": "^4.2.2", "microsoft/microsoft-graph": "^1.108", "nesbot/carbon": "^2.68.1", + "laravel/sail": "^1.16", "nunomaduro/collision": "^7.7", "socialiteproviders/microsoft-azure": "^5.1", "spatie/laravel-ignition": "^2.2" @@ -30,9 +31,10 @@ "laravel/pint": "^1.10.3", "laravel/sail": "^1.23", "mockery/mockery": "^1.6.2", - "nunomaduro/collision": "^7.7", + "laravel/pint": "^1.10.3", "phpunit/phpunit": "^10.2.4", "spatie/laravel-ignition": "^2.2" + }, "autoload": { "classmap": [ @@ -42,7 +44,7 @@ "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", - "Database\\Seeders\\": "database/seeders/" + "Database\\Seeders\\": "database/seeders/" }, "files": [ "app/helpers.php" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..76b8906 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,79 @@ +# For more information: https://laravel.com/ +services: + mensa.php: + container_name: mensa.php + pull_policy: missing + build: + context: ./vendor/laravel/sail/runtimes/${SAIL_VERSION:-8.1} + dockerfile: Dockerfile + args: + WWWGROUP: '${WWWGROUP}' + image: ghcr.io/vslcatena/mensa:sail-${SAIL_VERSION:-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: + - net + depends_on: + - mensa.db + mensa.db: + hostname: db + container_name: mensa.db + image: 'mariadb:10' + ports: + - '${FORWARD_DB_PORT:-3306}:3306' + environment: + MYSQL_ROOT_PASSWORD: '${DB_ROOT_PASSWORD}' + MYSQL_ROOT_HOST: "%" + MYSQL_DATABASE: '${DB_DATABASE}' + MYSQL_USER: '${DB_USERNAME}' + MYSQL_PASSWORD: '${DB_PASSWORD}' + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + volumes: + - 'db_data:/var/lib/mysql' + - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' + networks: + - net + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"] + retries: 3 + timeout: 5s + + #phpmyadmin + mensa.phpmyadmin: + image: ghcr.io/linuxserver/phpmyadmin + hostname: phpmyadmin + container_name: mensa.phpmyadmin + profiles: + - dev + environment: + PMA_HOST: db + PMA_USER: root + PMA_PASSWORD: '${DB_PASSWORD}' + ports: + - "8181:80" + networks: + - net + +networks: + net: + driver: bridge + ipam: + driver: default + config: + - subnet: 192.168.8.224/29 + driver_opts: + com.docker.network.bridge.name: mensa_net + +volumes: + db_data: + driver: local