added support for init
This commit is contained in:
parent
595667e24e
commit
3cf3770bea
30
compose.yml
Normal file
30
compose.yml
Normal file
@ -0,0 +1,30 @@
|
||||
services:
|
||||
fpm:
|
||||
hostname: fpm
|
||||
image: git.shihaam.dev/dockerfiles/php-fpm:8.3
|
||||
volumes:
|
||||
- ./:/var/www/html/
|
||||
nginx:
|
||||
hostname: nginx
|
||||
image: git.shihaam.dev/dockerfiles/nginx-fpm:latest
|
||||
volumes_from:
|
||||
- fpm
|
||||
ports:
|
||||
- 9000:80
|
||||
composer:
|
||||
hostname: composer
|
||||
image: composer:2.7.9
|
||||
volumes:
|
||||
- ./:/var/www/html/
|
||||
working_dir: /var/www/html
|
||||
database:
|
||||
image: mariadb:lts
|
||||
hostname: database
|
||||
restart: always
|
||||
environment:
|
||||
- MYSQL_RANDOM_ROOT_PASSWORD=yes
|
||||
- MYSQL_USER=cusport
|
||||
- MYSQL_PASSWORD=cusport
|
||||
- MYSQL_DATABASE=cusport
|
||||
volumes:
|
||||
- ./.db:/var/lib/mysql
|
34
helper
34
helper
@ -10,6 +10,40 @@ elif [[ "$1" == "fix_storage" ]]; then
|
||||
docker compose exec fpm chmod -R ug+x bootstrap/cache
|
||||
elif [[ "$1" == "mysql" ]]; then
|
||||
docker compose exec database "$@"
|
||||
elif [[ "$1" == "init" ]]; then
|
||||
cat <<EOL > compose.yml
|
||||
services:
|
||||
fpm:
|
||||
hostname: fpm
|
||||
image: git.shihaam.dev/dockerfiles/php-fpm:8.3
|
||||
volumes:
|
||||
- ./:/var/www/html/
|
||||
nginx:
|
||||
hostname: nginx
|
||||
image: git.shihaam.dev/dockerfiles/nginx-fpm:latest
|
||||
volumes_from:
|
||||
- fpm
|
||||
ports:
|
||||
- 9000:80
|
||||
composer:
|
||||
hostname: composer
|
||||
image: composer:2.7.9
|
||||
volumes:
|
||||
- ./:/var/www/html/
|
||||
working_dir: /var/www/html
|
||||
database:
|
||||
image: mariadb:lts
|
||||
hostname: database
|
||||
restart: always
|
||||
environment:
|
||||
- MYSQL_RANDOM_ROOT_PASSWORD=yes
|
||||
- MYSQL_USER=cusport
|
||||
- MYSQL_PASSWORD=cusport
|
||||
- MYSQL_DATABASE=cusport
|
||||
volumes:
|
||||
- ./.db:/var/lib/mysql
|
||||
EOL
|
||||
echo "compose.yml file created successfully!"
|
||||
else
|
||||
docker compose exec fpm "$@"
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user