kphcdr 1 vuosi sitten
vanhempi
commit
061d954074
2 muutettua tiedostoa jossa 63 lisäystä ja 1 poistoa
  1. 62 0
      docker-compose.example.yml
  2. 1 1
      docker-compose.yml

+ 62 - 0
docker-compose.example.yml

@@ -0,0 +1,62 @@
+version: '3'
+
+networks:
+  default:
+    driver: bridge
+
+services:
+  nginx:
+    container_name: ${ABBREVIATION}-nginx
+    image:  docker.io/nginx:1.23.0
+    restart: always
+    depends_on:
+      - "php"
+    volumes:
+      - ./www:/www
+      - ./config/nginx/conf.d:/etc/nginx/conf.d
+      - ./logs/nginx/logs:/logs
+    networks:
+      - default
+    ports:
+      - "${NUMBER}080:80"
+
+  php:
+    build:
+     context: ./service/php
+     args:
+       TZ: "Asia/Shanghai"
+    restart: always
+    container_name: ${ABBREVIATION}-php
+    working_dir: /www/server
+    volumes:
+      - ./www:/www
+      - ./config/php/php.ini:/usr/local/etc/php/php.ini
+    networks:
+      - default
+
+  mysql:
+    container_name: ${ABBREVIATION}-mysql
+    image:  docker.io/mysql:5.7.29 #X86架构
+    restart: always
+    platform: linux/amd64  #osx系统才需要
+    ports:
+      - "${NUMBER}3306:3306"   
+    volumes:
+      - ./data/mysql5.7.29/lib:/var/lib/mysql
+      - ./config/mysql/mysqld.cnf:/etc/mysql/my.cnf
+    environment:
+      MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
+      TZ: "Asia/Shanghai"
+    networks:
+      - default
+
+  redis:
+    container_name: ${ABBREVIATION}-redis
+    image:  docker.io/redis:6.2.7
+    restart: always
+    volumes:
+      - ./data/redis:/data
+    networks:
+      - default
+    ports:
+      - "${NUMBER}6379:6379"

+ 1 - 1
docker-compose.yml

@@ -42,7 +42,7 @@ services:
     ports:
       - "${NUMBER}3306:3306"   
     volumes:
-      - ./data/mysql5.7.29/lib:/var/lib/mysql
+      - ./data/mysql/lib:/var/lib/mysql
       - ./config/mysql/mysqld.cnf:/etc/mysql/my.cnf
     environment:
       MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}