simplify composer example

This commit is contained in:
Ruben Momoa
2024-08-22 09:50:07 +02:00
parent b4c00d4459
commit d3b38ddf77
2 changed files with 16 additions and 40 deletions

View File

@@ -1,25 +0,0 @@
# the laravel version to install (empty for latest)
LARAVEL_VERSION=
# weather to run "npm dev" at boot
BOOT_NPM_DEV=true
# runs npm install at boot
BOOT_NPM_INSTALL=true
# runs composer install at boot
BOOT_COMPOSER_INSTALL=true
# external ports
FORWARD_LARAVEL_PORT=80
FORWARD_VITE_PORT=5173
FORWARD_DB_PORT=3306
FORWARD_REDIS_PORT=6379
FORWARD_MAILPIT_PORT=1025
FORWARD_MAILPIT_DASHBOARD_PORT=8025
# DB settings (this will overwrite the defaults in the laravel project)
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=password

View File

@@ -1,20 +1,21 @@
version: '3' version: '3'
services: services:
app: app:
build: image: vistanarvas/simple-laravel
context: build
dockerfile: Dockerfile
image: laravel
ports: ports:
- '${FORWARD_LARAVEL_PORT:-80}:8080' - '8080:80'
- '${FORWARD_VITE_PORT:-5173}:5173' - '5173:5173'
environment: environment:
LARAVEL_VERSION: '${LARAVEL_VERSION}' WEBSERVER_PORT: 80
AUTO_START_NPM_DEV: '${AUTO_START_NPM_DEV:-false}'
DB_HOST: mysql
DB_CONNECTION: mysql DB_CONNECTION: mysql
env_file: DB_HOST: mysql
.env DB_PORT: 3306
DB_DATABASE: laravel
DB_USERNAME: laravel
DB_PASSWORD: password
BOOT_NPM_DEV: true # also starts `npm dev`
BOOT_NPM_INSTALL: true # runs `npm install` on boot
BOOT_COMPOSER_INSTALL: true # runs `composer install` on boot
depends_on: depends_on:
- mysql - mysql
- redis - redis
@@ -23,7 +24,7 @@ services:
mysql: mysql:
image: 'mysql/mysql-server:8.0' image: 'mysql/mysql-server:8.0'
ports: ports:
- '${FORWARD_DB_PORT:-3306}:3306' - '3306:3306'
environment: environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: '%' MYSQL_ROOT_HOST: '%'
@@ -37,15 +38,15 @@ services:
redis: redis:
image: 'redis:alpine' image: 'redis:alpine'
ports: ports:
- '${FORWARD_REDIS_PORT:-6379}:6379' - '6379:6379'
volumes: volumes:
- 'redis:/data' - 'redis:/data'
mailpit: mailpit:
image: 'axllent/mailpit:latest' image: 'axllent/mailpit:latest'
ports: ports:
- '${FORWARD_MAILPIT_PORT:-1025}:1025' - '1025:1025'
- '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025' - '8025:8025'
volumes: volumes:
mysql: mysql: