From 3cf3770beaad13af97e7d17702575431fbd7c307 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 8 Sep 2024 05:10:29 +0500 Subject: [PATCH] added support for init --- compose.yml | 30 ++++++++++++++++++++++++++++++ helper | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 compose.yml diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..0211a33 --- /dev/null +++ b/compose.yml @@ -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 diff --git a/helper b/helper index 4b40a5e..ea1db08 100755 --- a/helper +++ b/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 < 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