From 97a7b05c46e730b3a43b10641941b1d01208cdf6 Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Wed, 28 May 2025 13:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=AC=E8=A9=A6=20docker=2020250528?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yaml | 47 +++++++++++++++++++++++++++++++++++++++ docker/nginx/default.conf | 22 ++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 docker-compose.yaml create mode 100644 docker/nginx/default.conf diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..4e27c78 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,47 @@ +version: "3.8" + +services: + app: + image: laravelsail/php82-composer + container_name: KTVCentral + working_dir: /var/www/html + volumes: + - ./:/var/www/html + depends_on: + - mariadb + environment: + DB_CONNECTION: mariadb + DB_HOST: mariadb + DB_PORT: 3306 + DB_DATABASE: Karaoke-Kingpin + DB_USERNAME: Karaoke-Kingpin + DB_PASSWORD: ESM7yTPMnavFmbBH + command: php-fpm + + mariadb: + image: mariadb:10.6 + container_name: KTVCentral_db + restart: always + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: Karaoke-Kingpin + MYSQL_USER: Karaoke-Kingpin + MYSQL_PASSWORD: ESM7yTPMnavFmbBH + volumes: + - dbdata:/var/lib/mysql + ports: + - "3306:3306" + + nginx: + image: nginx:stable-alpine + container_name: KTVCentral_nginx + ports: + - "8080:80" + volumes: + - ./:/var/www/html + - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf + depends_on: + - app + +volumes: + dbdata: \ No newline at end of file diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf new file mode 100644 index 0000000..f313856 --- /dev/null +++ b/docker/nginx/default.conf @@ -0,0 +1,22 @@ +server { + listen 80; + index index.php index.html; + server_name localhost; + + root /var/www/html/public; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + include fastcgi_params; + fastcgi_pass app:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME /var/www/html/public$fastcgi_script_name; + } + + location ~ /\.ht { + deny all; + } +} \ No newline at end of file